[CMake] CMake problem on Solaris with suncc
Hi all, I try to build my program with cmake on Solaris using cc (suncc). The problem is when activating -xtarget=ultra -xarch=v9 I get linker errors wrong ELF class: ELFCLASS64. I created a simple hello world example to reproduce the problem. It consists of a simple hello-library and a test program that links against it. Both should be compiled with the same settings, so I don't understand why this linker error occurs. Does cmake configure any 32bit settings that may conflict with xarch=v9 ? Output: Scanning dependencies of target helloworld [100%] Building CXX object test/CMakeFiles/helloworld.dir/main.cpp.o /home/sag/OPC.UA/hello/test/main.cpp, line 1: Warning: Last line in file /home/sag/OPC.UA/hello/hello/hello.h is not terminated with a newline. 1 Warning(s) detected. Linking CXX executable helloworld ld: fatal: file CMakeFiles/helloworld.dir/main.cpp.o: wrong ELF class: ELFCLASS64 ld: fatal: File processing errors. No output written to helloworld *** Error code 1 The following command caused the error: cd /home/sag/OPC.UA/hello/build/test /home/sag/cmake-2.6.2-SunOS- sparc/bin/cmake -E cmake_link_script CMakeFiles/helloworld.dir/link.txt -- verbose= make: Fatal error: Command failed for target `test/helloworld' Current working directory /home/sag/OPC.UA/hello/build *** Error code 1 The following command caused the error: make -f test/CMakeFiles/helloworld.dir/build.make test/CMakeFiles/helloworld.dir/build make: Fatal error: Command failed for target `test/CMakeFiles/helloworld.dir/all' Current working directory /home/sag/OPC.UA/hello/build *** Error code 1 The following command caused the error: make -f CMakeFiles/Makefile2 all make: Fatal error: Command failed for target `all' -- mit freundlichen Grüßen / best regards Gerhard Gappmeier ascolab GmbH - automation systems communication laboratory Tel.: +49 9131 691 123 Fax: +49 9131 691 128 Web: http://www.ascolab.com GPG-Key: http://www.ascolab.com/gpg/gg.asc hello.tar.gz Description: application/compressed-tar ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CMake problem on Solaris with suncc
Here is the environment I enforce on solaris to build with cmake/solaris/suncc64 : export LINKFLAGS=-m64 ; export CFLAGS=-m64 ; export CPPFLAGS=-m64; export CC=/opt/SUNWspro/bin/suncc ; export CPP=/opt/SUNWspro/bin/suncc; export CXX=/opt/SUNWspro/bin/sunCC Hope this helps ! Cyril Gerhard Gappmeier a écrit : Hi all, I try to build my program with cmake on Solaris using cc (suncc). The problem is when activating -xtarget=ultra -xarch=v9 I get linker errors wrong ELF class: ELFCLASS64. I created a simple hello world example to reproduce the problem. It consists of a simple hello-library and a test program that links against it. Both should be compiled with the same settings, so I don't understand why this linker error occurs. Does cmake configure any 32bit settings that may conflict with xarch=v9 ? Output: Scanning dependencies of target helloworld [100%] Building CXX object test/CMakeFiles/helloworld.dir/main.cpp.o /home/sag/OPC.UA/hello/test/main.cpp, line 1: Warning: Last line in file /home/sag/OPC.UA/hello/hello/hello.h is not terminated with a newline. 1 Warning(s) detected. Linking CXX executable helloworld ld: fatal: file CMakeFiles/helloworld.dir/main.cpp.o: wrong ELF class: ELFCLASS64 ld: fatal: File processing errors. No output written to helloworld *** Error code 1 The following command caused the error: cd /home/sag/OPC.UA/hello/build/test /home/sag/cmake-2.6.2-SunOS-sparc/bin/cmake -E cmake_link_script CMakeFiles/helloworld.dir/link.txt --verbose= make: Fatal error: Command failed for target `test/helloworld' Current working directory /home/sag/OPC.UA/hello/build *** Error code 1 The following command caused the error: make -f test/CMakeFiles/helloworld.dir/build.make test/CMakeFiles/helloworld.dir/build make: Fatal error: Command failed for target `test/CMakeFiles/helloworld.dir/all' Current working directory /home/sag/OPC.UA/hello/build *** Error code 1 The following command caused the error: make -f CMakeFiles/Makefile2 all make: Fatal error: Command failed for target `all' -- mit freundlichen Grüßen / best regards Gerhard Gappmeier ascolab GmbH - automation systems communication laboratory Tel.: +49 9131 691 123 Fax: +49 9131 691 128 Web: http://www.ascolab.com GPG-Key: http://www.ascolab.com/gpg/gg.asc ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CMake problem on Solaris with suncc
cyril_wobow wrote: Here is the environment I enforce on solaris to build with cmake/solaris/suncc64 : export LINKFLAGS=-m64 ; export CFLAGS=-m64 ; export CPPFLAGS=-m64; export CC=/opt/SUNWspro/bin/suncc ; export CPP=/opt/SUNWspro/bin/suncc; export CXX=/opt/SUNWspro/bin/sunCC Hope this helps ! Cyril CMake does not look at LINKFALGS? It uses LDFLAGS. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CMake problem on Solaris with suncc
Hi this was a good tip to configure the compiler using the environment variables. I just changed -m64 to the old xtarget settings, because this is to new for my compiler. I removed all compiler settings from the CMakeLists.txt and now it seems to work, except from the assembler. Now I'm using this environment. #!/bin/bash # configure compiler CC=/home/local/opt/SUNWspro.11/bin/cc CXX=/home/local/opt/SUNWspro.11/bin/CC CPP=$CXX CFLAGS=-xtarget=ultra -xarch=v9 CXXFLAGS=-xtarget=ultra -xarch=v9 LDFLAGS=-xarch=v9 # configure cmake PATH=$PATH:/home/sag/cmake-2.6.2-SunOS-sparc/bin export PATH CC CXX CPP CFLAGS CXXFLAGS LDFLAGS When compiling the assembler file I now get the error /usr/ccs/bin/as: /path/to/file/platforms/linux/cas32.s, line 7: error: cannot use v8plus instructions in a non-v8plus target binary because it seems not to evaluate the CFLAGS with arch=v9 Is there any other environment variable that is passed to the assembler? On Monday 27 October 2008 13:52:01 you wrote: Here is the environment I enforce on solaris to build with cmake/solaris/suncc64 : export LINKFLAGS=-m64 ; export CFLAGS=-m64 ; export CPPFLAGS=-m64; export CC=/opt/SUNWspro/bin/suncc ; export CPP=/opt/SUNWspro/bin/suncc; export CXX=/opt/SUNWspro/bin/sunCC -- mit freundlichen Grüßen / best regards Gerhard Gappmeier ascolab GmbH - automation systems communication laboratory Tel.: +49 9131 691 123 Fax: +49 9131 691 128 Web: http://www.ascolab.com GPG-Key: http://www.ascolab.com/gpg/gg.asc ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CMake problem on Solaris with suncc
Bill Hoffman schrieb: You have to start with an empty cache. Re-run cmake with no CMakeCache.txt. Then make sure the CMAKE_C_FLAGS are correct. Shouldn't that be CMAKE_ASM_FLAGS if the .s file has the language property set to ASM? HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CMake problem on Solaris with suncc
Hi, CMakeCache.txt is not the problem. I do out-of-source builds and completely remove the build folder before each build CMAKE_ASM_FLAGS sounds good and I found some references in the internet about it. But this seems not to be used anymore. If you do a grep in cmake/Modules for ASMFLAGS or ASM_FLAGS you'll get no hits. I found this line in CMakeASMCompiler.cmake of the generated files. SET(CMAKE_ASM_COMPILER_ARG1 ) How is this variable set? On Monday 27 October 2008 15:52:37 Hendrik Sattler wrote: Bill Hoffman schrieb: You have to start with an empty cache. Re-run cmake with no CMakeCache.txt. Then make sure the CMAKE_C_FLAGS are correct. Shouldn't that be CMAKE_ASM_FLAGS if the .s file has the language property set to ASM? HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- mit freundlichen Grüßen / best regards Gerhard Gappmeier ascolab GmbH - automation systems communication laboratory Tel.: +49 9131 691 123 Fax: +49 9131 691 128 Web: http://www.ascolab.com GPG-Key: http://www.ascolab.com/gpg/gg.asc ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake