compilation fails with dmd
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
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.
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/
I'll check it out.
I'm pretty new to Arch, but here's what I noticed when comparing the PKGBUILD with some other D packages:
-
archshould probably be('i686' 'x86_64')as those are the architectures supported by dmd -
groupscan bedlang, there's some stuff there already -
dependsshould probably includedmdasdbuildstatinvokes it - You can replace the two
git submodulecommands with one:git submodule update --init - Matter of subjective taste but
md/ms/ptseem 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.
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 --recursiveis what you usually want for getting submodules. It is more common to do it as part ofbuild()function though unless you need applying custom patches (which is whatprepare()is intended for) - Mention
dmdas build dependency explicitly asdtoolscan be installed also withldcorgdcand your build script doesn't support them -
installwith explicit target file permissions is preferable overcp(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 ofdbuildstat-makedot -
arch('any')should only be used if your PKGBUILD supportsldc/gdcand thus ARM/MIPS targets.