CMake for D2 ready for testers

Jens Mueller jens.k.mueller at gmx.de
Tue Feb 22 06:18:21 PST 2011


Jens Mueller wrote:
> Gour wrote:
> > On Tue, 22 Feb 2011 09:42:46 +0100
> > Gour <gour at atmarama.net> wrote:
> > 
> > > I installed CMakeD from the archlinux package, then pulled from the
> > > repo and tried tests suite. Here is the result:
> > 
> > Oops...forgot to run 'make test':
> > 
> > [gour at atmarama build] make test
> > Running tests...
> > Test project /home/gour/repos/cmaked2/tests/build
> >     Start 1: app_1
> > 1/9 Test #1: app_1 ............................   Passed    0.00 sec
> >     Start 2: app_2
> > 2/9 Test #2: app_2 ............................   Passed    0.00 sec
> >     Start 3: app_3
> > 3/9 Test #3: app_3 ............................   Passed    0.00 sec
> >     Start 4: app_5
> > 4/9 Test #4: app_5 ............................   Passed    0.00 sec
> >     Start 5: app_4
> > 5/9 Test #5: app_4 ............................   Passed    0.00 sec
> >     Start 6: app_6
> > 6/9 Test #6: app_6 ............................   Passed    0.00 sec
> >     Start 7: app_7
> > 7/9 Test #7: app_7 ............................   Passed    0.00 sec
> >     Start 8: moduleB.d
> > 8/9 Test #8: moduleB.d ........................   Passed    0.05 sec
> >     Start 9: moduleA.d
> > 9/9 Test #9: moduleA.d ........................   Passed    0.05 sec
> > 
> > 100% tests passed, 0 tests failed out of 9
> > 
> > Total Test time (real) =   0.28 sec
> > 
> > 
> > So, everything is fine on x86_64 (however, still using 32bit dmd2
> > waiting for new package).
> 
> If you want a 64-bit build. Change in tests/CMakeLists.txt the lines
> SET( GLOBAL_DMD_DEFS "-w -wi" )
> SET( GLOBAL_GCC_DEFS "-Wall -pedantic -m32" )
> to
> SET( GLOBAL_DMD_DEFS "-w -wi -m64" )
> SET( GLOBAL_GCC_DEFS "-Wall -pedantic -m64" )
> 
> I just did this.
> $ file app_1/app_1
> app_1/app_1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not
> stripped
> 
> But something is wrong with app7 on amd64.
> 
> $ make test
> Running tests...
> Test project /home/jkm/local/build/cmaked2/tests/build
>     Start 1: app_1
> 1/9 Test #1: app_1 ............................   Passed    0.00 sec
>     Start 2: app_2
> 2/9 Test #2: app_2 ............................   Passed    0.00 sec
>     Start 3: app_3
> 3/9 Test #3: app_3 ............................   Passed    0.00 sec
>     Start 4: app_5
> 4/9 Test #4: app_5 ............................   Passed    0.00 sec
>     Start 5: app_4
> 5/9 Test #5: app_4 ............................   Passed    0.00 sec
>     Start 6: app_6
> 6/9 Test #6: app_6 ............................   Passed    0.00 sec
>     Start 7: app_7
> 7/9 Test #7: app_7 ............................***Exception: SegFault  0.01 sec
>     Start 8: moduleA.d
> 8/9 Test #8: moduleA.d ........................   Passed    0.15 sec
>     Start 9: moduleB.d
> 9/9 Test #9: moduleB.d ........................   Passed    0.11 sec
> 
> 89% tests passed, 1 tests failed out of 9
> 
> Total Test time (real) =   0.30 sec
> 
> The following tests FAILED:
>           7 - app_7 (SEGFAULT)
> Errors while running CTest
> make: *** [test] Error 8
> 
> Somebody used CMakeD successfully with gdc and even there app_7
> segfaulted. So it appears to be a problem in app_7. If you comment out
> the timing code it works. I will look later into this.

I changed the timing code within app7 to use StopWatch. It now works.
But there are some hacks in CMakeD's test examples.
In
lib_2/CMakeLists.txt
app_5/CMakeLists.txt
the -m32 was pretty hard coded.
For building 64 bit it should be now sufficient to set
SET( GLOBAL_DMD_DEFS "-w -wi -m64" )
SET( GLOBAL_GCC_DEFS "-Wall -pedantic -m64" )
For 32 Bit
SET( GLOBAL_DMD_DEFS "-w -wi" )
SET( GLOBAL_GCC_DEFS "-Wall -pedantic" )
the way it is set right now should work. But remember that you need to
specify -m32 if you want to use the C linker. Because at least with gcc
on x86-64 it defaults to link 64-bit code.
That's why the -m32 is optional for dmd since this seems to be the
default. But as said earlier this will very likely change once 64-bit is
stable.

I pushed the changes to google code. Have a try.

Jens


More information about the Digitalmars-d mailing list