Can't link with cryptopp on MacOSx 10.10

357 views
Skip to first unread message

David Xanatos

unread,
Mar 12, 2015, 3:20:01 PM3/12/15
to cryptop...@googlegroups.com
I can compile its just fine but when i try to link it into a Qt project i get linker errors, it cant find the symbols in the library :(
on a older version of MacOSx it works just fine.

Whats the issue here with new MacOS?

my cryptopp version is 5.6.1 (8/9/2010, SVN r520)
Message has been deleted

David Xanatos

unread,
Mar 12, 2015, 3:55:16 PM3/12/15
to cryptop...@googlegroups.com
I was asked by mail for more details so here they are:
i compiles the so and the a files, booth same directory

when i included in my Qt5.3.2 (original build, not self compiled) the so file
LIBS += -lqjson -lqbencode $$OUT_PWD/../../../NeoLoader/
crypto++/libcryptopp.so -lz
i get http://pastebin.com/y85jBHKm

when i include the a file
LIBS += -lqjson -lqbencode $$OUT_PWD/../../../NeoLoader/crypto++/libcryptopp.a -lz
i get thise: http://pastebin.com/nMxvM2H4

all other libs are freshly compiled with QT

David Xanatos

unread,
Mar 13, 2015, 2:33:09 AM3/13/15
to cryptop...@googlegroups.com
this guy here seams to head have the same problem:
https://groups.google.com/forum/#!searchin/cryptopp-users/macosx|sort:date/cryptopp-users/krqX0SIRHXM/dag0bA5Y-TcJ

it seams that the missing symbols mostly are such that have some std:: thing as argument...

I'm not sure what measure from the thread fixed the issue..

David Xanatos

unread,
Mar 13, 2015, 3:07:52 AM3/13/15
to cryptop...@googlegroups.com
is there a way to edit  messages?
anyways...

i also get
Davids-Mac:crypto++ david$ nm -g libcryptopp.so | c++filt | grep RandomPool::GenerateIntoBufferedTransformation | grep " T "
00000000001177e0 T CryptoPP::RandomPool::GenerateIntoBufferedTransformation(CryptoPP::BufferedTransformation&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long long)
Davids-Mac:crypto++ david$

the __1 in my cryptopp

qt uses:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -Xclang -include-pch -Xclang NeoSetup/c++.pch -pipe -w -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.6 -Wall -W -fPIE -DQT_LARGEFILE_SUPPORT -DQT_NETWORK_LIB -DQT_WIDGETS_LIB -DQT_CONCURRENT_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_CONCURRENT_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../Qt/5.3/clang_64/mkspecs/macx-clang -I../NeoSetup -I../../../../Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/Headers -I../../../../Qt/5.3/clang_64/lib/QtConcurrent.framework/Versions/5/Headers -I../../../../Qt/5.3/clang_64/lib/QtNetwork.framework/Versions/5/Headers -I../../../../Qt/5.3/clang_64/lib/QtGui.framework/Versions/5/Headers -I../../../../Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -F/Users/david/Qt/5.3/clang_64/lib -o main.o ../NeoSetup/main.cpp

i don't want to change the qt seettings as than I may need to recompile qt and i don't what that,
so what exactly i have to change in the GNUmakefile if cryptopp in order to compile it such that it will match?

David Xanatos

unread,
Mar 13, 2015, 3:56:40 AM3/13/15
to cryptop...@googlegroups.com
I tryed now compiling using the same settings qt dies

CXX = clang++
CXXFLAGS += -std=c++11 -Wno-c++11-narrowing

but that also did not helped same linker error when linking into the qt project
do i need to change some linker flag may be?

David Xanatos

unread,
Mar 13, 2015, 4:09:12 AM3/13/15
to cryptop...@googlegroups.com
One more observation on that mac os version that works (lion) i get
Lions-Mac-2:crypto++ User$ nm -g libcryptopp.so | c++filt | grep RandomPool::GenerateIntoBufferedTransformation | grep " T "
00000000001116b0 T CryptoPP::RandomPool::GenerateIntoBufferedTransformation(CryptoPP::BufferedTransformation&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long long)

no __1 namespace....


so i would deduce from what informations i gathered qt is not using llvm and on the older mac needer is crypto++
but on the new we mac (yosemite) it uses LLVM:/ now the question is now do i force through the make file of crypto++ to not use llvm as it was on the older os?

David Xanatos

unread,
Mar 13, 2015, 5:29:46 AM3/13/15
to cryptop...@googlegroups.com
I have some progress

CXXFLAGS += -std=c++11 -Wno-c++11-narrowing -stdlib=libstdc++

and

libcryptopp.so: $(LIBOBJS)
    $(CXX) -shared -o $@ $(LIBOBJS) -stdlib=libstdc++

reduced the errors to one

Undefined symbols for architecture x86_64:
  "vtable for CryptoPP::SHA256", referenced from:
      CryptoPP::SHA256::SHA256(CryptoPP::SHA256 const&) in NeoSetup.o
      CryptoPP::SHA256::SHA256() in NeoSetup.o
      CryptoPP::SHA256::SHA256() in DownloadTask.o
      CryptoPP::SHA256::SHA256(CryptoPP::SHA256 const&) in DownloadTask.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64

not sure whats wrong here why this only export shoudl fail, in this project i also use EC signatures that works fine,
in an other project i use almost everything i get this error and a second simmilar one:

Undefined symbols for architecture x86_64:
  "vtable for CryptoPP::SHA224", referenced from:
      CryptoPP::SHA224::SHA224(CryptoPP::SHA224 const&) in PrivateKey.o
      CryptoPP::SHA224::SHA224() in PrivateKey.o
      CryptoPP::SHA224::SHA224(CryptoPP::SHA224 const&) in PublicKey.o
      CryptoPP::SHA224::SHA224() in PublicKey.o
      CryptoPP::SHA224::SHA224() in HashFunction.o
      CryptoPP::SHA224::SHA224(CryptoPP::SHA224 const&) in HashFunction.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for CryptoPP::SHA256", referenced from:
      CryptoPP::SHA256::SHA256(CryptoPP::SHA256 const&) in PrivateKey.o
      CryptoPP::SHA256::SHA256() in PrivateKey.o
      CryptoPP::SHA256::SHA256(CryptoPP::SHA256 const&) in PublicKey.o
      CryptoPP::SHA256::SHA256() in PublicKey.o
      CryptoPP::SHA256::SHA256() in HashFunction.o
      CryptoPP::SHA256::SHA256(CryptoPP::SHA256 const&) in HashFunction.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64


David Xanatos

unread,
Mar 13, 2015, 5:47:08 AM3/13/15
to cryptop...@googlegroups.com
i think i made it :D i needed to also add CRYPTOPP_DISABLE_ASM to my projects preprocessor definition.

now i will need to test if everything runs fine, but one question still on my mind why is CRYPTOPP_DISABLE_ASM defined by default on mac os?
Reply all
Reply to author
Forward
0 new messages