Those are Clang bugs [0].

Multiple definitions error has been fixed in [1] and probably (just
guessing) made it to Clang 6.0.0 release.

Undefined references bug happens when you link code compiled by Clang to
static libstdc++ (and probably other static libs too) compiled by GCC. I
think there is still no solution for this one.

[0] https://lists.llvm.org/pipermail/cfe-dev/2017-April/053530.html
[1] https://reviews.llvm.org/D33620

śr., 2 maj 2018 o 18:16 Sukhbir Singh <yamailingl...@riseup.net> napisał(a):

> Hi,
>
> I have a question about C++ ABI compatibility (or lack thereof) between
> mingw-w64 and clang.
>
> I am trying to cross-compile go-webrtc
> [https://github.com/keroserene/go-webrtc] with mingw-w64 (cgo), which has
> webrtc as its dependency (compiled with clang). I am running into errors
> during the linking stage:
>
>     /var/tmp/dist/mingw-w64/x86_64-w64-mingw32/include/malloc.h:183:0:
> note: this is the location of the previous definition
>      #define alloca(x) __builtin_alloca((x))
>      ^
>     # github.com/keroserene/go-webrtc
>
> /var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/../lib/libstdc++.a(cow-stdexcept.o):
> In function `std::string::_M_data() const':
>
> /var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/cow-stdexcept.cc:44:
> multiple definition of `std::logic_error::logic_error(std::logic_error
> const&)'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/peerconnection.cc.o:peerconnection.cc:(.text$_ZNSt11logic_errorC2ERKS_[_ZNSt11logic_errorC2ERKS_]+0x0)
> <http://github.com/keroserene/go-webrtc/_obj/peerconnection.cc.o:peerconnection.cc:(.text$_ZNSt11logic_errorC2ERKS_%5B_ZNSt11logic_errorC2ERKS_%5D+0x0)>:
> first defined here
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x5a9):
> undefined reference to `cricket::AudioCodec::ToString() const'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x6de):
> undefined reference to `webrtc::RtpExtension::ToString() const'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x813):
> undefined reference to `cricket::DataCodec::ToString() const'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x8f5):
> undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int)'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x96a):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xa1b):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xbf8):
> undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int)'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xc6d):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xd20):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xdb1):
> undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int)'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xe26):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xed5):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xf6d):
> undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int)'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0xfe2):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x1094):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x112c):
> undefined reference to `rtc::FatalMessage::FatalMessage(char const*, int)'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x11a1):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>     /tmp/go-build868110800/
> github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o:ctestenums.cc:(.text+0x1254):
> undefined reference to `rtc::FatalMessage::~FatalMessage()'
>
> /var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/ld:
> $WORK/github.com/keroserene/go-webrtc/_obj/ctestenums.cc.o: bad reloc
> address 0xc0 in section `.rdata'
>     collect2: error: ld returned 1 exit status
>
> The webrtc library has the missing symbols and so I was wondering if this
> error stems from incompatibility between mingw-w64 and clang, and if yes,
> what's the possible fix for it?
>
> --
> Sukhbir
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to