On Monday, 21 March 2016 01:22:47 UTC+1, Jeffrey Walton wrote:
>
>
>
> On Sunday, March 20, 2016 at 5:22:28 PM UTC-4, Gaetano Mendola wrote:
>>
>> The following snippet:
>>
>> #include <cryptopp/hex.h>
>> int main() {
>> CryptoPP::HexDecoder myHexDecoder;
>> }
>>
>>
>> does not link with clang++-3.8/clang++3.7 while it links just fine with
>> gcc5.3.1
>>
>> $ apt-show-versions libcrypto++-dev
>> libcrypto++-dev:amd64/xenial 5.6.1-9 uptodate
>>
>>
>> The error:
>> $ clang++-3.8 main.cpp -lcrypto++
>> /tmp/main-1ac893.o: In function
>> `CryptoPP::Unflushable<CryptoPP::Filter>::Flush(bool, int, bool)':
>> main.cpp:(.text._ZN8CryptoPP11UnflushableINS_6FilterEE5FlushEbib[_ZN8CryptoPP11UnflushableINS_6FilterEE5FlushEbib]+0xf):
>> undefined reference to `CryptoPP::DEFAULT_CHANNEL'
>> clang: error: linker command failed with exit code 1 (use -v to see
>> invocation)
>>
>>
> CryptoPP::DEFAULT_CHANNEL is just a std::string. I'm guessing you are
> mixing/matching GNU and LLVM runtimes.
>
> You might try with the GNU runtime (clang++ -stdlib=libstdc++ ...) or the
> LLVM runtime (clang++ -stdlib=libc++ ...).
>
> If you dump symbols in libcrypto++ using nm (from -lcrypto++), then you
> will see one of two things. You could see a std::__1::string (LLVM and
> inlined namespace) or std::string (GNU and no additional namespace).
> Obviously, LLVM tells you it needs -stdlib=libc++, while GNU tells you it
> needs -stdlib=libstdc++. But its easy enough just to try them.
>
> Also see "Where does the __1 symbol come from when using LLVM's libc++?" (
> http://stackoverflow.com/q/29293394) on Stack Overflow.
>
> Jeff
>
I tried and it didn't work. Using LLVM runtime that's not the only symbol
not found.
Having say that what was puzzling me most of all was the fact that I have
another system
where it was working just fine, I find out that on the new system they
compiled libcrypto
using -std=c++11 (apparently)
$ cat /etc/issue
Ubuntu 14.04.3 LTS \n \l
$ nm /usr/lib/libcryptopp.a | c++filt | grep DEFAULT_CHANNEL
U CryptoPP::DEFAULT_CHANNEL
The other system where it does not work:
$ cat /etc/issue
Ubuntu Xenial Xerus (development branch) \n \l
$ nm /usr/lib/libcryptopp.a | c++filt | grep DEFAULT_CHANNEL
U CryptoPP::DEFAULT_CHANNEL[abi:cxx11]
and there we go:
http://allanmcrae.com/2015/06/the-case-of-gcc-5-1-and-the-two-c-abis/
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.