CMake, Cross Compile & Double Declarations

pooltechniker

Well-Known Member
Hallo,

hat zwar nichts mit *BSD zu tun, aber vielleicht kann mir hier jemand helfen:
Da meine SPARC Übersetzungskiste (Ultra 60) mit Solaris 10 etwas lahm ist hab ich mir auf einer aktuellen x86-Mühle Solaris 10 x86 installiert, und möchte die zum erstellen von SPARC Binaries benutzen.
binutils & gcc hab ich übersetzt, Cross Compile funktioniert für SW mit GNU autotools auch ohne Probleme.
Aktuell scheitere ich aber an Synergy, welches CMake nutzt - ich hab von CMake leider keine Ahnung, auch die Doku hat mich nicht wirklich weitergebracht.
Beim übersetzen bekomme ich folgende Fehler:
Code:
[pooltechniker@synergy /home/pooltechniker/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/pooltechniker/synergy/src/lib/arch/../common/common.h:146,
                from /home/pooltechniker/synergy/src/lib/arch/../arch/Arch.h:38,
                from /home/pooltechniker/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/pooltechniker/synergy/src/lib/arch/../common/common.h:146,
                from /home/pooltechniker/synergy/src/lib/arch/../arch/Arch.h:38,
                from /home/pooltechniker/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---

Meine CMake Toolchain sieht folgendermaßen aus:
Code:
# 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/pooltechniker/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)

Selber Code lässt sich mit dem gcc/g++ für x86 und ohne Sysroot für SPARC problemlos übersetzen.
Der Inhalt von /opt/cc_sparc/sysroot/ kommt von meiner Ultra 60 - auf welcher sich Synergy auch problemlos übersetzen lässt. Kann mir jemand sagen was ich falsch mache? Danke!
 
Zurück
Oben