Best build tool for D projects
Chris Molozian
chris at cmoz.me
Wed May 18 08:58:24 PDT 2011
Thanks to everyone for the help and advice on choosing a build tool for
my D+LLVM project. I settled on Jam (ftjam) in the end, the major factor
being cross-platform support and prebuilt binaries for a variety of
operating systems.
The documentation for Jam I've found is very lacking but have struggled
to put together a working build script. My Jamfile looks like this so far:
------------------------------------------------------------------------
/CC = dmd ;
CCFLAGS = -fPIC -O -inline -release -w ;
DFILES =
src/main.d ; # should be scanned from src dir
LINK = $(CC) ;
LINKFLAGS = -L-lstdc++ -L-ldl ;
C++ = g++ ;
C++FLAGS =
-I/usr/include
-DNDEBUG
-D_GNU_SOURCE
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
-O3
-fomit-frame-pointer
-fno-exceptions
-fPIC
-Woverloaded-virtual
-Wcast-qual ; # should be generated from `llvm-config --cxxflags`
# override the Link action to correct for the dmd compiler -o flag
actions Link bind NEEDLIBS {
$(LINK) $(LINKFLAGS) -of$(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS)
}
Objects $(DFILES) ;
MainFromObjects puckc : $(DFILES:S=.o) ;
LinkLibraries puckc : libllvmd ;
Library libllvmd : libs/llvm-2.9/Ext.cpp libs/llvm-2.9/Target.cpp ;/
------------------------------------------------------------------------
I'm not very experienced dealing with linker errors, the build output
shows these errors:
...found 152 target(s)...
...updating 5 target(s)...
C++ libs/llvm-2.9/Ext.o
C++ libs/llvm-2.9/Target.o
Archive libllvmd.a
ar: creating libllvmd.a
Ranlib libllvmd.a
Dc src/main.o
Link puckc
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(gcx_3d4_122.o):
In function `_D2gc3gcx3Gcx4markMFPvPvZv':
src/gc/gcx.d:(.text._D2gc3gcx3Gcx4markMFPvPvZv+0x165): undefined
reference to `_D4core5bitop3btsFNbPmmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(gcx_3d4_122.o):
In function `_D2gc3gcx3Gcx11fullcollectMFPvZm':
src/gc/gcx.d:(.text._D2gc3gcx3Gcx11fullcollectMFPvZm+0x3e4): undefined
reference to `_D4core5bitop3bsfFNaNbmZi'
src/gc/gcx.d:(.text._D2gc3gcx3Gcx11fullcollectMFPvZm+0x47f): undefined
reference to `_D4core5bitop3bsfFNaNbmZi'
src/gc/gcx.d:(.text._D2gc3gcx3Gcx11fullcollectMFPvZm+0x596): undefined
reference to `_D4core5bitop3btrFNbPmmZi'
src/gc/gcx.d:(.text._D2gc3gcx3Gcx11fullcollectMFPvZm+0x792): undefined
reference to `_D4core5bitop3btrFNbPmmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(lifetime_5c0_478.o):
In function `_D2rt8lifetime11newCapacityFmmZm':
src/rt/lifetime.d:(.text._D2rt8lifetime11newCapacityFmmZm+0x3a):
undefined reference to `_D4core5bitop3bsrFNaNbmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(gcbits_3c0_21c.o):
In function `_D2gc6gcbits6GCBits9testClearMFmZm':
src/gc/gcbits.d:(.text._D2gc6gcbits6GCBits9testClearMFmZm+0x18):
undefined reference to `_D4core5bitop3btrFNbPmmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(gcbits_3c0_21c.o):
In function `_D2gc6gcbits6GCBits7testSetMFmZm':
src/gc/gcbits.d:(.text._D2gc6gcbits6GCBits7testSetMFmZm+0x18): undefined
reference to `_D4core5bitop3btsFNbPmmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(array_13b_5f7.o):
In function `_D3std5array16__T8AppenderTAaZ8Appender11newCapacityFmZm':
std/array.d:(.text._D3std5array16__T8AppenderTAaZ8Appender11newCapacityFmZm+0x1a):
undefined reference to `_D4core5bitop3bsrFNaNbmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(bitmanip_18c_31e.o):
In function `_D3std8bitmanip8BitArray7opIndexMxFmZb':
std/bitmanip.d:(.text._D3std8bitmanip8BitArray7opIndexMxFmZb+0x15):
undefined reference to `_D4core5bitop2btFNaNbxPmmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(bitmanip_18c_31e.o):
In function `_D3std8bitmanip8BitArray13opIndexAssignMFbmZb':
std/bitmanip.d:(.text._D3std8bitmanip8BitArray13opIndexAssignMFbmZb+0x1f):
undefined reference to `_D4core5bitop3btsFNbPmmZi'
std/bitmanip.d:(.text._D3std8bitmanip8BitArray13opIndexAssignMFbmZb+0x2e):
undefined reference to `_D4core5bitop3btrFNbPmmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(array_76d_638.o):
In function `_D3std5array17__T8AppenderTAyaZ8Appender11newCapacityFmZm':
std/array.d:(.text._D3std5array17__T8AppenderTAyaZ8Appender11newCapacityFmZm+0x1a):
undefined reference to `_D4core5bitop3bsrFNaNbmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(numeric_86a_120.o):
In function `_D3std7numeric3Fft6__ctorMFAfZC3std7numeric3Fft':
std/numeric.d:(.text._D3std7numeric3Fft6__ctorMFAfZC3std7numeric3Fft+0x5f):
undefined reference to `_D4core5bitop3bsfFNaNbmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(numeric_86c_4d8.o):
In function `_D3std7numeric12isPowerOfTwoFmZb':
std/numeric.d:(.text._D3std7numeric12isPowerOfTwoFmZb+0xd): undefined
reference to `_D4core5bitop3bsrFNaNbmZi'
std/numeric.d:(.text._D3std7numeric12isPowerOfTwoFmZb+0x1b): undefined
reference to `_D4core5bitop3bsfFNaNbmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(numeric_872_5ab.o):
In function `_D3std7numeric14__T6StrideTAfZ6Stride6nStepsMFNdmZm':
std/numeric.d:(.text._D3std7numeric14__T6StrideTAfZ6Stride6nStepsMFNdmZm+0x2a):
undefined reference to `_D4core5bitop3bsfFNaNbmZi'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib/libphobos2.a(array_162_6f0.o):
In function `_D3std5array18__T8AppenderTAAyaZ8Appender11newCapacityFmZm':
std/array.d:(.text._D3std5array18__T8AppenderTAAyaZ8Appender11newCapacityFmZm+0x1e):
undefined reference to `_D4core5bitop3bsrFNaNbmZi'
collect2: ld returned 1 exit status
--- errorlevel 1
dmd -L-lstdc++ -L-ldl -ofpuckc src/main.o libllvmd.a
...failed Link puckc ...
...failed updating 1 target(s)...
...updated 4 target(s)...
Anyone got any experience using Jam or advice and help on solving the
link errors.
Cheers,
Chris
On 13/05/11 18:38, Chris Molozian wrote:
> Hey All,
>
> This is my first post to the mailing list, I'm an avid follower of D's
> development and am currently using it to develop a compiler for my
> thesis work. One of the goals of this stage of the development work is
> to provide a simple build environment to compile the codebase on
> Linux, Windows and Mac OS X. The only complex aspects of the build
> process is compiling the LLVM-D bindings and linking to LLVM.
>
> I'm evaluating build tools for this purpose and have concluded
> (correct me if I'm wrong) that the D-orientated build tools: Bud
> <http://www.dsource.org/projects/build> and DSSS
> <http://www.dsource.org/projects/dsss> are abandoned. I'm not sure
> whether development on xfBuild
> <https://bitbucket.org/h3r3tic/xfbuild/overview> is still going on.
>
> I'd like to use a tool that is easy for testers to install on their
> system (preferably pre-built binaries are available) and use to
> compile my work. I've been looking at C/C++ build tools and have
> narrowed it down to these:
>
> * Jam (ftjam) <http://www.freetype.org/jam/index.html>,
> cross-platform and platform independent build language. Lots of
> variants with the same name, therefore finding it hard to find
> good tutorials and documentation.
> * Boost.Build (bjam) <http://www.boost.org/boost-build2/>, not
> sure how it differs to ftjam.
> * Cook <http://miller.emu.id.au/pmiller/software/cook/>, can't
> find whether it can be built for use on Windows. No pre-built
> Windows binary. Very extensive documentation, although I think
> the default build file name is silly "Howto.cook" :-) .
>
> After all this preamble I guess what I'm asking is... what (if any)
> cross-platform build tools does everyone use with their D projects?
> Any feedback on experiences with any of the build tools I've mentioned
> is also greatly appreciated. If you can suggest any alternatives,
> please do.
>
> If you've read this far, thanks for taking the time to read it :-) and
> sorry for the long message.
>
> Cheers,
>
> Chris
>
> PS: I've seen the CMakeD <http://www.dsource.org/projects/cmaked>
> module, I know a lot of people recommend CMake for cross-platform
> builds and that the KDE guys use it. I have tried to like it... but
> settled on hating it. The procedural language is daft and ugly and I
> loathe the CMakeLists.txt file that goes in each directory. I've
> already ruled it out.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110518/2b3b3456/attachment-0001.html>
More information about the Digitalmars-d
mailing list