Hello, I'm using CMake 3.2.2 on Solaris 10 x86. I've built a toolchain to cross compile for SPARC, which is working fine for software with GNU autotools. But now I'm trying to compile Synergy, which is based on CMake, and I have lots of troubles with double declarations:
[sepp@synergy /home/sepp/synergy]% gmake [ 0%] Building CXX object src/lib/arch/CMakeFiles/arch.dir/Arch.cpp.o In file included from /opt/cc_sparc/sysroot/usr/include/stdlib.h:17:0, from /home/sepp/synergy/src/lib/arch/../common/common.h:146, from /home/sepp/synergy/src/lib/arch/../arch/Arch.h:38, from /home/sepp/synergy/src/lib/arch/Arch.cpp:19: /opt/cc_sparc/sysroot/usr/include/iso/stdlib_iso.h:118:38: error: conflicting declaration of 'void* std::bsearch(const void*, const void*, std::size_t, std::size_t, int (*)(const void*, const void*))' with 'C++' linkage int (*)(const void *, const void *)); ^ /opt/cc_sparc/sysroot/usr/include/iso/stdlib_iso.h:113:14: note: previous declaration with 'C' linkage extern void *bsearch(const void *, const void *, size_t, size_t, ^ In file included from /opt/cc_sparc/sysroot/usr/include/iso/stdlib_iso.h:30:0, from /opt/cc_sparc/sysroot/usr/include/stdlib.h:17, from /home/sepp/synergy/src/lib/arch/../common/common.h:146, from /home/sepp/synergy/src/lib/arch/../arch/Arch.h:38, from /home/sepp/synergy/src/lib/arch/Arch.cpp:19: /opt/cc_sparc/sysroot/usr/include/iso/stdlib_iso.h:131:61: error: conflicting declaration 'const char* restrict' extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ^ /opt/cc_sparc/sysroot/usr/include/iso/stdlib_iso.h:131:33: note: previous declaration as 'wchar_t* restrict' extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ^ /opt/cc_sparc/sysroot/usr/include/iso/stdlib_iso.h:133:56: error: conflicting declaration 'const char* restrict' extern int mbtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); ^ /opt/cc_sparc/sysroot/usr/include/iso/stdlib_iso.h:133:28: note: previous declaration as 'wchar_t* restrict' extern int mbtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t); [snip] My CMake Toolchain-file looks like this: # this one is important SET(CMAKE_SYSTEM_NAME SunOS) #this one not so much SET(CMAKE_SYSTEM_VERSION 1) # specify the cross compiler SET(CMAKE_C_COMPILER /opt/cc_sparc/bin/sparc-sun-solaris2.10-gcc) SET(CMAKE_CXX_COMPILER /opt/cc_sparc/bin/sparc-sun-solaris2.10-g++) SET(CMAKE_C_FLAGS "--sysroot=/opt/cc_sparc/sysroot") SET(CMAKE_CXX_FLAGS "--sysroot=/opt/cc_sparc/sysroot") SET(CURL_LIBRARY /opt/cc_sparc/sysroot/lib) SET(CURL_INCLUDE_DIR /opt/cc_sparc/sysroot/include) SET(CMAKE_SYSROOT_PATH /opt/cc_sparc/sysroot) # where is the target environment SET(CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT_PATH}/usr/lib") # Don't search for programs in the host environment SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Search for the libraries and headers in the target environment SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) include_directories(SYSTEM /home/sepp/synergy/src/lib/common) include_directories(SYSTEM /opt/cc_sparc/sysroot/usr/include) include_directories(SYSTEM /opt/cc_sparc/sysroot/usr/include/c++/3.4.3) include_directories(SYSTEM /opt/cc_sparc/sysroot/usr/include/c++/3.4.3/sparc-sun-solaris2.10) --- When I compile the same code for Solaris 10 x86 without this toolchain and alternate sysroot, everything works fine. Can someone tell me what I'm doing wrong? Thanks -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake