zezer3 / cmaked2

Automatically exported from code.google.com/p/cmaked2
0 stars 0 forks source link

Fails on Ubuntu x86_64, gdc 4.4.6 (dmd 2.050) #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Would be great if cmaked2 worked with gdc on Ubuntu x86_64!

What steps will reproduce the problem?
Tests fail to set up for Ubuntu,  architecture x86_64, cmake 2.8.1, with gdc 
4.4.6 (dmd 2.050).

Please provide any additional information below.

 ./run_tests_linux.sh 
-- The C compiler identification is GNU
-- The D compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
**** Debug Info: Enter CMakeDInformation.cmake
**** Debug Info: CMAKE_SYSTEM_NAME = Linux
**** Debug Info: CMAKE_D_COMPILER_ID = 
**** Debug Info: CMAKE_BASE_NAME = gdc
**** Debug Info: Exit CMakeDInformation.cmake
-- Check for working D compiler: /opt/usr/local/bin/gdc
**** Debug Info: Enter CMakeDInformation.cmake
**** Debug Info: CMAKE_SYSTEM_NAME = Linux
**** Debug Info: CMAKE_D_COMPILER_ID = 
**** Debug Info: CMAKE_BASE_NAME = gdc
**** Debug Info: Exit CMakeDInformation.cmake
-- Check for working D compiler: /opt/usr/local/bin/gdc -- broken
-- To force a specific D compiler set the DC environment variable
--     ie - export DC="/usr/bin/dmd"
CMake Error at /usr/local/share/cmake-2.8/Modules/CMakeTestDCompiler.cmake:44 
(MESSAGE):
  The D compiler "/opt/usr/local/bin/gdc" is not able to compile a simple
  test program.

  It fails with the following output:

   Change Dir: /home/kfeng/src/cmaked_test_build/release/CMakeFiles/CMakeTmp

  Run Build Command:/usr/bin/make "cmTryCompileExec/fast"

  /usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
  CMakeFiles/cmTryCompileExec.dir/build

  make[1]: Entering directory
  `/home/kfeng/src/cmaked_test_build/release/CMakeFiles/CMakeTmp'

  /usr/local/bin/cmake -E cmake_progress_report
  /home/kfeng/src/cmaked_test_build/release/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building D object CMakeFiles/cmTryCompileExec.dir/testDCompiler

  /opt/usr/local/bin/gdc -fversion=Posix -fversion=Build
  -od/home/kfeng/src/cmaked_test_build/release/CMakeFiles/CMakeTmp/
  -oCMakeFiles/cmTryCompileExec.dir/testDCompiler -c
  /home/kfeng/src/cmaked_test_build/release/CMakeFiles/CMakeTmp/testDCompiler.d

  Error: version identifier 'Posix' is reserved and cannot be set

  make[1]: Leaving directory
  `/home/kfeng/src/cmaked_test_build/release/CMakeFiles/CMakeTmp'

  make[1]: *** [CMakeFiles/cmTryCompileExec.dir/testDCompiler] Error 1

  make: *** [cmTryCompileExec/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (PROJECT)

-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `test'.  Stop.
-- The C compiler identification is GNU
-- The D compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
**** Debug Info: Enter CMakeDInformation.cmake
**** Debug Info: CMAKE_SYSTEM_NAME = Linux
**** Debug Info: CMAKE_D_COMPILER_ID = 
**** Debug Info: CMAKE_BASE_NAME = gdc
**** Debug Info: Exit CMakeDInformation.cmake
-- Check for working D compiler: /opt/usr/local/bin/gdc
**** Debug Info: Enter CMakeDInformation.cmake
**** Debug Info: CMAKE_SYSTEM_NAME = Linux
**** Debug Info: CMAKE_D_COMPILER_ID = 
**** Debug Info: CMAKE_BASE_NAME = gdc
**** Debug Info: Exit CMakeDInformation.cmake
-- Check for working D compiler: /opt/usr/local/bin/gdc -- broken
-- To force a specific D compiler set the DC environment variable
--     ie - export DC="/usr/bin/dmd"
CMake Error at /usr/local/share/cmake-2.8/Modules/CMakeTestDCompiler.cmake:44 
(MESSAGE):
  The D compiler "/opt/usr/local/bin/gdc" is not able to compile a simple
  test program.

  It fails with the following output:

   Change Dir: /home/kfeng/src/cmaked_test_build/debug/CMakeFiles/CMakeTmp

  Run Build Command:/usr/bin/make "cmTryCompileExec/fast"

  /usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
  CMakeFiles/cmTryCompileExec.dir/build

  make[1]: Entering directory
  `/home/kfeng/src/cmaked_test_build/debug/CMakeFiles/CMakeTmp'

  /usr/local/bin/cmake -E cmake_progress_report
  /home/kfeng/src/cmaked_test_build/debug/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building D object CMakeFiles/cmTryCompileExec.dir/testDCompiler

  /opt/usr/local/bin/gdc -fversion=Posix -fversion=debugBuild
  -od/home/kfeng/src/cmaked_test_build/debug/CMakeFiles/CMakeTmp/
  -oCMakeFiles/cmTryCompileExec.dir/testDCompiler -c
  /home/kfeng/src/cmaked_test_build/debug/CMakeFiles/CMakeTmp/testDCompiler.d

  Error: version identifier 'Posix' is reserved and cannot be set

  make[1]: Leaving directory
  `/home/kfeng/src/cmaked_test_build/debug/CMakeFiles/CMakeTmp'

  make[1]: *** [CMakeFiles/cmTryCompileExec.dir/testDCompiler] Error 1

  make: *** [cmTryCompileExec/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (PROJECT)

-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `test'.  Stop.

Original issue reported on code.google.com by kfmf...@gmail.com on 6 Dec 2010 at 3:46

GoogleCodeExporter commented 9 years ago
Trying the failed test compile by hand works fine - I will investigate some 
more:

kfeng@ml115:/tmp$ cat junk.d
int main(char[][] args)
{return args.sizeof-1;}
kfeng@ml115:/tmp$ gdc -o junk junk.d
kfeng@ml115:/tmp$ ./junk
kfeng@ml115:/tmp$ 

Original comment by kfmf...@gmail.com on 6 Dec 2010 at 3:56

GoogleCodeExporter commented 9 years ago
Removing -fversion=Posix from Linux-gdc.cmake gets me further, but now, I am 
stuck with errors in CMakeDetermineCompilerABI.cmake around Lines 38-50 where 
you seem to be doing string matching:

kfeng@ml115:~/src/cmaked2/tests$ ./run_tests_linux.sh 
-- The C compiler identification is GNU
-- The D compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
**** Debug Info: Enter CMakeDInformation.cmake
**** Debug Info: CMAKE_SYSTEM_NAME = Linux
**** Debug Info: CMAKE_D_COMPILER_ID = 
**** Debug Info: CMAKE_BASE_NAME = gdc
**** Debug Info: Exit CMakeDInformation.cmake
-- Check for working D compiler: /opt/usr/local/bin/gdc
**** Debug Info: Enter CMakeDInformation.cmake
**** Debug Info: CMAKE_SYSTEM_NAME = Linux
**** Debug Info: CMAKE_D_COMPILER_ID = 
**** Debug Info: CMAKE_BASE_NAME = gdc
**** Debug Info: Exit CMakeDInformation.cmake
-- Check for working D compiler: /opt/usr/local/bin/gdc -- works
-- Detecting D compiler ABI info
**** Debug Info: Enter CMakeDInformation.cmake
**** Debug Info: CMAKE_SYSTEM_NAME = Linux
**** Debug Info: CMAKE_D_COMPILER_ID = 
**** Debug Info: CMAKE_BASE_NAME = gdc
**** Debug Info: Exit CMakeDInformation.cmake
-- Detecting D compiler ABI info - done
gdc: unrecognized option '-wi'
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: s
cc1d: warning: unrecognized gcc debugging option: =
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: h
cc1d: warning: unrecognized gcc debugging option: o
cc1d: warning: unrecognized gcc debugging option: m
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: k
cc1d: warning: unrecognized gcc debugging option: f
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: n
cc1d: warning: unrecognized gcc debugging option: g
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: s
cc1d: warning: unrecognized gcc debugging option: r
cc1d: warning: unrecognized gcc debugging option: c
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: c
cc1d: warning: unrecognized gcc debugging option: m
cc1d: warning: unrecognized gcc debugging option: k
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: d
cc1d: warning: unrecognized gcc debugging option: _
cc1d: warning: unrecognized gcc debugging option: t
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: s
cc1d: warning: unrecognized gcc debugging option: t
cc1d: warning: unrecognized gcc debugging option: _
cc1d: warning: unrecognized gcc debugging option: b
cc1d: warning: unrecognized gcc debugging option: u
cc1d: warning: unrecognized gcc debugging option: i
cc1d: warning: unrecognized gcc debugging option: l
cc1d: warning: unrecognized gcc debugging option: d
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: r
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: l
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: s
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: _
cc1d: warning: unrecognized gcc debugging option: 8
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: C
cc1d: warning: unrecognized gcc debugging option: k
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: F
cc1d: warning: unrecognized gcc debugging option: i
cc1d: warning: unrecognized gcc debugging option: l
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: s
cc1d: warning: unrecognized gcc debugging option: /
cc1d: warning: unrecognized gcc debugging option: _
cc1d: warning: unrecognized gcc debugging option: 8
cc1d: warning: unrecognized gcc debugging option: .
cc1d: warning: unrecognized gcc debugging option: d
cc1d: warning: unrecognized gcc debugging option: -
cc1d: warning: unrecognized gcc debugging option: d
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: n
cc1d: warning: unrecognized gcc debugging option: d
cc1d: warning: unrecognized gcc debugging option: .
cc1d: warning: unrecognized gcc debugging option: c
cc1d: warning: unrecognized gcc debugging option: m
cc1d: warning: unrecognized gcc debugging option: k
cc1d: warning: unrecognized gcc debugging option: e
cc1d: warning: unrecognized gcc debugging option: .
cc1d: warning: unrecognized gcc debugging option: t
cc1d: warning: unrecognized gcc debugging option: m
/home/kfeng/src/cmaked2/tests/app_8/app_8.d:3: Error: module a is in file 'a.d' 
which cannot be read
import path[0] = 
/opt/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.4.6/../../../../include
/d2/4.4.6/x86_64-unknown-linux-gnu
import path[1] = 
/opt/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.4.6/../../../../include
/d2/4.4.6
CMake Error at /usr/local/share/cmake-2.8/Modules/dependencies.cmake:21 (file):
  file Internal CMake error when trying to open file:
  /home/kfeng/src/cmaked_test_build/release/app_8/CMakeFiles/app_8.d-depend.cmake.tmp
  for reading.

Original comment by kfmf...@gmail.com on 6 Dec 2010 at 4:47

GoogleCodeExporter commented 9 years ago
With gdc, say I have a hellomodule that I want to build into an libh.a - I 
would want to do this to compile and archive:
> gdc -c hellomodule.d -o hellomodule.o
> ar rcs libh.a hellomodule.o

For hellomain, I would want to compile and link like this:
> gdc -I "../hellomodule/" -c hellomain.d -o hellomain.o
> gdc hellomain.o -L ../hellomodule/ -lh -o hello

I am still trying to manipulate cmaked2 to behave like this.  
Any suggestions would be greatly appreciated.

Original comment by kfmf...@gmail.com on 7 Dec 2010 at 10:04

GoogleCodeExporter commented 9 years ago
OK, I've managed to hack together something that builds a static hellomodule 
and links it with an hellomain.  Later, I will see if I can generalize what I 
did and put it back into cmaked2 and get the tests to build, but here is an 
overview for those of you who are trying to get gdc to work:

1. remove -fversion=Posix from Linux-gdc.cmake

2. SET( CMAKE_D_CREATE_STATIC_LIBRARY  "<CMAKE_AR> rcs <TARGET> <OBJECTS>" )

3. hellomodule's CMakeLists.txt - note the hellomodule.o, not hellomodule.d here
ADD_LIBRARY( h STATIC hellomodule.o )
SET_TARGET_PROPERTIES( h PROPERTIES LINKER_LANGUAGE D )

4. hellomain's CMakeLists.txt - hardcoding the -I is obviously no good: will 
cleanup later 
SET( CMAKE_D_FLAGS "-I /home/kfeng/dev/robolab/d/src/hellomodule" )
ADD_EXECUTABLE( hello hellomain.d ) 
TARGET_LINK_LIBRARIES( hello h ) 
SET_TARGET_PROPERTIES( hello PROPERTIES LINKER_LANGUAGE D )

Original comment by kfmf...@gmail.com on 7 Dec 2010 at 11:59

GoogleCodeExporter commented 9 years ago
It looks like the fixes in Comment 4 are easy to patch except the hard-coding 
in 4.

SET( CMAKE_D_FLAGS "-I /home/kfeng/dev/robolab/d/src/hellomodule" )

I am still investigating how to set CMAKE_D_FLAGS safely.

Original comment by kfmf...@gmail.com on 7 Dec 2010 at 1:54

GoogleCodeExporter commented 9 years ago
If I use INCLUDE_DIRECTORIES(), I can avoid the hard-coding noted in Comment 5.
With these fixes, I get a slight improvement in running  ./run_tests_linux.sh 

56% tests passed, 4 tests failed out of 9

Original comment by kfmf...@gmail.com on 7 Dec 2010 at 2:01

GoogleCodeExporter commented 9 years ago
Having problems tweaking this line:

/usr/local/bin/cmake -E cmake_link_script CMakeFiles/app_4.dir/link.txt 
--verbose=1
/opt/usr/local/bin/gdc   -fversion=debugBuild -g   CMakeFiles/app_4.dir/app_4 
-oapp_4  -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3 ../lib_2/liblib_2.a -lc  

I want to get rid of -lc and -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3 - anyone 
know how to affect the generation of link.txt?  I can't seem to trace its 
generation from the cmaked2 code.

Original comment by kfmf...@gmail.com on 8 Dec 2010 at 2:33

GoogleCodeExporter commented 9 years ago
OK - I'm committing what I have - there are still issues as only 5/9 tests 
build and clear on Ubuntu amd64, but this should be better than before.

Original comment by kfmf...@gmail.com on 8 Dec 2010 at 2:58

GoogleCodeExporter commented 9 years ago

Original comment by jens.k.mueller@gmail.com on 9 Dec 2010 at 9:03

GoogleCodeExporter commented 9 years ago
Thanks for your effort.
I pushed a change to make it work.
I tested with
gdc (GCC) 4.4.5 20101001 (gdc hg, using dmd 2.049)
on Debian.
Let me know if it does not work for you. All examples are building but app_7 
segfaults.

Original comment by jens.k.mueller@gmail.com on 9 Dec 2010 at 10:12

GoogleCodeExporter commented 9 years ago
Better let me also know if it works. Then I'll close this bug. But having app_7 
segfault is annoying. I'll guess it's a bug in gdc. Do you know anything more?

Original comment by jens.k.mueller@gmail.com on 15 Dec 2010 at 11:33

GoogleCodeExporter commented 9 years ago
Hi, I apologize for the delay.

On my amd64 Ubuntu 10.04.1 LTS, it still fails to link/test 4, 5, 6, 7 (see 
attachment).
gdc (GCC) 4.4.6 20101206 (prerelease gdc hg, using dmd 2.050)

I suspect this may be due to my configuration - in the build, I see references 
to gcc 4.4.5 - it's been a few weeks since I looked at this - I may have built 
from the 4.4.5 code-base (don't know why this would show up as 4.4.6 in gdc, 
though).

Anyhow, it's fine with me if you would like to close this bug.
Thank you for looking in this.

Original comment by kfmf...@gmail.com on 16 Dec 2010 at 2:49

Attachments:

GoogleCodeExporter commented 9 years ago
I should try the same version as you to see if it works here. I hope I find 
some time for doing this the next days. Won't close this bug until it works for 
you. I'll guess we do not have much users but for the little we have it should 
work.

Original comment by jens.k.mueller@gmail.com on 18 Dec 2010 at 12:18

GoogleCodeExporter commented 9 years ago
Sorry. I just found some time to look into the issue.
I followed the instructions on https://bitbucket.org/goshawk/gdc/wiki/Home.
$ hg tip
changeset:   433:aba6c8857d64
tag:         tip
user:        Iain Buclaw <ibuclaw@ubuntu.com>
date:        Tue Jan 04 05:27:29 2011 +0000
summary:     Issue #133 - Segfault On AA Foreach

And it works for me. I cannot reproduce the problem. Which version are you 
using. I wonder why you are using gcc 4.4.6 instead of 4.4.5. This is really 
strange.
$ gdc --version
gdc (GCC) 4.4.5 20101001 (gdc hg, using dmd 2.051)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Can you try again closely following https://bitbucket.org/goshawk/gdc/wiki/Home?

Original comment by jens.k.mueller@gmail.com on 4 Jan 2011 at 9:36

GoogleCodeExporter commented 9 years ago
Just for the record to clarify how I run the tests. I change to tests 
directory. Then
$ mkdir build
$ cd build
$ cmake ..
$ make all
$ make test

Somehow make test shows all tests as passing.
$ ctest -V
shows that app7 actually segfaults. Don't know why make test acts that stupid.

Original comment by jens.k.mueller@gmail.com on 4 Jan 2011 at 9:45

GoogleCodeExporter commented 9 years ago
I believe the issue it fixed in ea37db6ef4.

Original comment by jens.k.mueller@gmail.com on 24 Feb 2011 at 6:53