DBuildStat icon indicating copy to clipboard operation
DBuildStat copied to clipboard

compilation fails with dmd

Open wilzbach opened this issue 9 years ago • 5 comments

Why is not possible to compile DBuildStat with dmd?

Running it with rdmd works fine ...

dbuildstat.o:dbuildstat.d:function _Dmain: error: undefined reference to '_D2ae3sys3cmd3runFAAyaZv'
dbuildstat.o:dbuildstat.d:function _Dmain: error: undefined reference to '_D2ae3sys3cmd3runFAAyaZv'
dbuildstat.o:dbuildstat.d:function _D10dbuildstat4mainFAAyaZ7getDepsMFAyaZHAyaAya: error: undefined reference to '_D2ae3sys3cmd5queryFAAyaZAya'
dbuildstat.o:dbuildstat.d:_D10dbuildstat12__ModuleInfoZ: error: undefined reference to '_D2ae3sys3cmd12__ModuleInfoZ'
dbuildstat.o:dbuildstat.d:_D10dbuildstat12__ModuleInfoZ: error: undefined reference to '_D2ae5utils4json12__ModuleInfoZ'
dbuildstat.o:dbuildstat.d:_D10dbuildstat12__ModuleInfoZ: error: undefined reference to '_D2ae5utils5regex12__ModuleInfoZ'
dbuildstat.o:dbuildstat.d:_D10dbuildstat12__ModuleInfoZ: error: undefined reference to '_D6common12__ModuleInfoZ'
dbuildstat.o:dbuildstat.d:_D24TypeInfo_S6common6Module6__initZ: error: undefined reference to '_D6common6Module6__initZ'
dbuildstat.o:dbuildstat.d:_D24TypeInfo_S6common6Module6__initZ: error: undefined reference to '_D6common6Module9__xtoHashFNbNeKxS6common6ModuleZm'
dbuildstat.o:dbuildstat.d:_D24TypeInfo_S6common6Module6__initZ: error: undefined reference to '_D6common6Module11__xopEqualsFKxS6common6ModuleKxS6common6ModuleZb'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json28__T6toJsonTAS6common6ModuleZ6toJsonFAS6common6ModuleZAya: error: undefined reference to '_D2ae5utils8appender21__T12FastAppenderTyaZ12FastAppender3getMFNaNbNiZAya'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter25__T3putTAS6common6ModuleZ3putMFAS6common6ModuleZv: error: undefined reference to '_D2ae5utils8appender21__T12FastAppenderTyaZ12FastAppender10__T3putTaZ3putMFNaNbaZv'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter25__T3putTAS6common6ModuleZ3putMFAS6common6ModuleZv: error: undefined reference to '_D2ae5utils4json7__arrayZ'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter25__T3putTAS6common6ModuleZ3putMFAS6common6ModuleZv: error: undefined reference to '_D2ae5utils4json7__arrayZ'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter25__T3putTAS6common6ModuleZ3putMFAS6common6ModuleZv: error: undefined reference to '_D2ae5utils4json7__arrayZ'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter25__T3putTAS6common6ModuleZ3putMFAS6common6ModuleZv: error: undefined reference to '_D2ae5utils8appender21__T12FastAppenderTyaZ12FastAppender10__T3putTaZ3putMFNaNbaZv'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter25__T3putTAS6common6ModuleZ3putMFAS6common6ModuleZv: error: undefined reference to '_D2ae5utils8appender21__T12FastAppenderTyaZ12FastAppender10__T3putTaZ3putMFNaNbaZv'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter24__T3putTS6common6ModuleZ3putMFS6common6ModuleZv: error: undefined reference to '_D2ae5utils8appender21__T12FastAppenderTyaZ12FastAppender10__T3putTaZ3putMFNaNbaZv'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter12__T3putTAyaZ3putMFNbAyaZv: error: undefined reference to '_D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter9putStringMFNbxAaZv'
dbuildstat.o:dbuildstat.d:function _D2ae5utils4json79__T16CustomJsonWriterTS2ae5utils8appender21__T12FastAppenderTyaZ12FastAppenderZ16CustomJsonWriter12__T3putTG3mZ3putMFNaNbG3mZv: error: undefined reference to '_D2ae5utils4json7__arrayZ'
dbuildstat.o:dbuildstat.d:function _D2ae5utils8appender21__T12FastAppenderTyaZ12FastAppender11__T3putTAaZ3putMFNaNbAaZv: error: undefined reference to '_D2ae5utils8appender21__T12FastAppenderTyaZ12FastAppender7reserveMFNaNbmZv'
collect2: error: ld returned 1 exit status
--- errorlevel 1

wilzbach avatar Mar 07 '16 18:03 wilzbach

Because dmd does not compile imported modules by itself. You have to specify ALL modules used in an application to compile and link them. Usually this is done by a build tool, though (rdmd, dub etc.)

You can use rdmd to build programs if you use --build-only.

CyberShadow avatar Mar 07 '16 18:03 CyberShadow

You can use rdmd to build programs if you use --build-only.

Nice! I tried to make an AUR package out of this, here's my inital attempt. Would be nice to have your feedback on it ;-)

https://aur.archlinux.org/packages/dbuildstat-git/

wilzbach avatar Mar 07 '16 19:03 wilzbach

I'll check it out.

CyberShadow avatar Mar 07 '16 19:03 CyberShadow

I'm pretty new to Arch, but here's what I noticed when comparing the PKGBUILD with some other D packages:

  • arch should probably be ('i686' 'x86_64') as those are the architectures supported by dmd
  • groups can be dlang, there's some stuff there already
  • depends should probably include dmd as dbuildstat invokes it
  • You can replace the two git submodule commands with one: git submodule update --init
  • Matter of subjective taste but md/ms/pt seem a bit cryptic, I would use the full name (e.g. dbuildstat-makkedot

@Dicebot could offer more insight, he seems to have more experience making D packages for Arch.

CyberShadow avatar Mar 08 '16 20:03 CyberShadow

Sure. Some quick suggestions:

  • You don't need to explicitly mention PKGBUILD fields if they are assigned empty values, simply remove them.
  • git submodule update --init --recursive is what you usually want for getting submodules. It is more common to do it as part of build() function though unless you need applying custom patches (which is what prepare() is intended for)
  • Mention dmd as build dependency explicitly as dtools can be installed also with ldc or gdc and your build script doesn't support them
  • install with explicit target file permissions is preferable over cp (upstream build system may produce overly permissive binaries)
  • arbitrary renaming of upstream modules/files is generally a bad idea. I'd either keep plain names like makedot (pacman will tell you if it conflicts with any other installed package) or use a full prefix of dbuildstat-makedot
  • arch('any') should only be used if your PKGBUILD supports ldc/gdc and thus ARM/MIPS targets.

mihails-strasuns avatar Mar 09 '16 00:03 mihails-strasuns