how to build grpc to static link library on macOS - macos

I want to build grpc to static link library on macOS,my macOS system is macOS Monterey version 12.6(Intel chip).
I found https://chromium.googlesource.com/external/github.com/grpc/grpc/+/HEAD/BUILDING.md#building-with-cmake build shared libraries that is Dynamic-link library,but I want to get static-link library.
gcc version is
mindgood#minds-MacBook-Pro lib % gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
mindgood#minds-MacBook-Pro lib %
My ~/.zshrc config is
export ANDROID_HOME=/Users/mindgood/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export ANDROID_NDK=/Users/mindgood/Library/Android/sdk/ndk/25.1.8937393
export PATH="/usr/local/opt/openssl#3/bin:$PATH"
export CPATH=/usr/local/opt/openssl#3/include:"${CPATH}"
export PKG_CONFIG_PATH=/usr/local/opt/openssl#3/lib/pkgconfig:"${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH=/usr/local/opt/openssl#3/lib:"${LD_LIBRARY_PATH}"
I have installed openssl.
mindgood#minds-MacBook-Pro ~ % openssl version
OpenSSL 3.0.5 5 Jul 2022 (Library: OpenSSL 3.0.5 5 Jul 2022)
mindgood#minds-MacBook-Pro ~ % whereis opnessl
opnessl:
mindgood#minds-MacBook-Pro ~ % find / -name 'openssl'
/usr/bin/openssl
find: /usr/sbin/authserver: Permission denied
/usr/local/bin/openssl
/usr/local/include/openssl
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Aliases/openssl
/usr/local/opt/openssl
/usr/local/Cellar/openssl#3/3.0.5/bin/openssl
/usr/local/Cellar/openssl#3/3.0.5/include/openssl
/usr/local/Cellar/openssl#3/3.0.5/share/doc/openssl
/usr/local/share/doc/openssl
find: /Library/Application Support/Apple/ParentalControls/Users: Permission denied
find: /Library/Application Support/Apple/AssetCache/Data: Permission denied
find: /Library/Application Support/ApplePushService: Permission denied
find: /Library/Application Support/com.apple.TCC: Operation not permitted
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/openssl
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/openssl
^C
mindgood#minds-MacBook-Pro ~ %
mindgood#minds-MacBook-Pro ~ % cd /usr/local/lib
mindgood#minds-MacBook-Pro lib % ls
engines-1.1 libcrypto.3.dylib libcrypto.dylib libssl.3.dylib libssl.dylib
libcrypto.1.1.dylib libcrypto.a libssl.1.1.dylib libssl.a pkgconfig
mindgood#minds-MacBook-Pro lib %
then I use below command:
git clone --recurse-submodules -b v1.30.0 https://github.com/grpc/grpc
cd grpc
git checkout -b v1.22.x remotes/origin/v1.22.x
cmake ../grpc -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DgRPC_BUILD_CODEGEN=OFF -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-26 -DCMAKE_BUILD_TYPE=Release
cmake --build .
When I build grpc to static link library,An error occurs when the progress reaches 91%:
mindgood#minds-MacBook-Pro grpc % cmake --build .
Consolidate compiler generated dependencies of target address_sorting
[ 0%] Built target address_sorting
Consolidate compiler generated dependencies of target gpr
[ 2%] Built target gpr
Consolidate compiler generated dependencies of target c-ares
[ 5%] Built target c-ares
Consolidate compiler generated dependencies of target zlibstatic
[ 6%] Built target zlibstatic
Consolidate compiler generated dependencies of target grpc
[ 26%] Built target grpc
Consolidate compiler generated dependencies of target grpc_cronet
[ 44%] Built target grpc_cronet
Consolidate compiler generated dependencies of target grpc_unsecure
[ 59%] Built target grpc_unsecure
Consolidate compiler generated dependencies of target libprotobuf
[ 64%] Built target libprotobuf
Consolidate compiler generated dependencies of target grpc++
[ 67%] Built target grpc++
Consolidate compiler generated dependencies of target grpc++_cronet
[ 83%] Built target grpc++_cronet
Consolidate compiler generated dependencies of target grpc++_unsecure
[ 85%] Built target grpc++_unsecure
Consolidate compiler generated dependencies of target libprotoc
[ 90%] Built target libprotoc
Consolidate compiler generated dependencies of target grpc_plugin_support
[ 91%] Built target grpc_plugin_support
Consolidate compiler generated dependencies of target grpc_csharp_ext
[ 91%] Linking CXX shared library libgrpc_csharp_ext.so
ld: error: undefined symbol: X509_STORE_new
>>> referenced by ssl_transport_security.cc:787 (src/core/tsi/ssl_transport_security.cc:787)
>>> ssl_transport_security.cc.o:(tsi_ssl_root_certs_store_create(char const*)) in archive libgrpc.a
ld: error: undefined symbol: X509_STORE_free
>>> referenced by ssl_transport_security.cc:797 (src/core/tsi/ssl_transport_security.cc:797)
>>> ssl_transport_security.cc.o:(tsi_ssl_root_certs_store_create(char const*)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:806 (src/core/tsi/ssl_transport_security.cc:806)
>>> ssl_transport_security.cc.o:(tsi_ssl_root_certs_store_destroy(tsi_ssl_root_certs_store*)) in archive libgrpc.a
ld: error: undefined symbol: BIO_new_mem_buf
>>> referenced by ssl_transport_security.cc:593 (src/core/tsi/ssl_transport_security.cc:593)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:519 (src/core/tsi/ssl_transport_security.cc:519)
>>> ssl_transport_security.cc.o:(populate_ssl_context(ssl_ctx_st*, tsi_ssl_pem_key_cert_pair const*, char const*)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:563 (src/core/tsi/ssl_transport_security.cc:563)
>>> ssl_transport_security.cc.o:(populate_ssl_context(ssl_ctx_st*, tsi_ssl_pem_key_cert_pair const*, char const*)) in archive libgrpc.a
>>> referenced 1 more times
ld: error: undefined symbol: OPENSSL_sk_new_null
>>> referenced by x509.h:77 (/usr/local/opt/openssl#3/include/openssl/x509.h:77)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
ld: error: undefined symbol: PEM_read_bio_X509_AUX
>>> referenced by ssl_transport_security.cc:602 (src/core/tsi/ssl_transport_security.cc:602)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:602 (src/core/tsi/ssl_transport_security.cc:602)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:602 (src/core/tsi/ssl_transport_security.cc:602)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced 2 more times
ld: error: undefined symbol: X509_free
>>> referenced by ssl_transport_security.cc:632 (src/core/tsi/ssl_transport_security.cc:632)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:632 (src/core/tsi/ssl_transport_security.cc:632)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:641 (src/core/tsi/ssl_transport_security.cc:641)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced 4 more times
ld: error: undefined symbol: X509_get_subject_name
>>> referenced by ssl_transport_security.cc:608 (src/core/tsi/ssl_transport_security.cc:608)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:266 (src/core/tsi/ssl_transport_security.cc:266)
>>> ssl_transport_security.cc.o:(peer_from_x509(x509_st*, int, tsi_peer*)) in archive libgrpc.a
ld: error: undefined symbol: X509_NAME_dup
>>> referenced by ssl_transport_security.cc:614 (src/core/tsi/ssl_transport_security.cc:614)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
ld: error: undefined symbol: OPENSSL_sk_push
>>> referenced by x509.h:77 (/usr/local/opt/openssl#3/include/openssl/x509.h:77)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
ld: error: undefined symbol: ERR_clear_error
>>> referenced by ssl_transport_security.cc:622 (src/core/tsi/ssl_transport_security.cc:622)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:622 (src/core/tsi/ssl_transport_security.cc:622)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:604 (src/core/tsi/ssl_transport_security.cc:604)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced 2 more times
ld: error: undefined symbol: X509_STORE_add_cert
>>> referenced by ssl_transport_security.cc:623 (src/core/tsi/ssl_transport_security.cc:623)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:623 (src/core/tsi/ssl_transport_security.cc:623)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
ld: error: undefined symbol: ERR_get_error
>>> referenced by ssl_transport_security.cc:624 (src/core/tsi/ssl_transport_security.cc:624)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:624 (src/core/tsi/ssl_transport_security.cc:624)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:1237 (src/core/tsi/ssl_transport_security.cc:1237)
>>> ssl_transport_security.cc.o:(ssl_handshaker_next(tsi_handshaker*, unsigned char const*, unsigned int, unsigned char const**, unsigned int*, tsi_handshaker_result**, void (*)(tsi_result, void*, unsigned char const*, unsigned int, tsi_handshaker_result*), void*)) in archive libgrpc.a
>>> referenced 2 more times
ld: error: undefined symbol: OPENSSL_sk_pop_free
>>> referenced by x509.h:77 (/usr/local/opt/openssl#3/include/openssl/x509.h:77)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by x509v3.h:166 (/usr/local/opt/openssl#3/include/openssl/x509v3.h:166)
>>> ssl_transport_security.cc.o:(peer_from_x509(x509_st*, int, tsi_peer*)) in archive libgrpc.a
ld: error: undefined symbol: BIO_free
>>> referenced by ssl_transport_security.cc:648 (src/core/tsi/ssl_transport_security.cc:648)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:0 (src/core/tsi/ssl_transport_security.cc:0)
>>> ssl_transport_security.cc.o:(create_tsi_ssl_handshaker(ssl_ctx_st*, int, char const*, tsi_ssl_handshaker_factory*, tsi_handshaker**)) in archive libgrpc.a
>>> referenced by ssl_transport_security.cc:552 (src/core/tsi/ssl_transport_security.cc:552)
>>> ssl_transport_security.cc.o:(populate_ssl_context(ssl_ctx_st*, tsi_ssl_pem_key_cert_pair const*, char const*)) in archive libgrpc.a
>>> referenced 10 more times
ld: error: undefined symbol: X509_NAME_free
>>> referenced by ssl_transport_security.cc:0 (src/core/tsi/ssl_transport_security.cc:0)
>>> ssl_transport_security.cc.o:(x509_store_load_certs(x509_store_st*, char const*, unsigned int, stack_st_X509_NAME**)) in archive libgrpc.a
ld: error: undefined symbol: SSL_new
>>> referenced by ssl_transport_security.cc:1340 (src/core/tsi/ssl_transport_security.cc:1340)
>>> ssl_transport_security.cc.o:(create_tsi_ssl_handshaker(ssl_ctx_st*, int, char const*, tsi_ssl_handshaker_factory*, tsi_handshaker**)) in archive libgrpc.a
ld: error: undefined symbol: SSL_set_info_callback
>>> referenced by ssl_transport_security.cc:1352 (src/core/tsi/ssl_transport_security.cc:1352)
>>> ssl_transport_security.cc.o:(create_tsi_ssl_handshaker(ssl_ctx_st*, int, char const*, tsi_ssl_handshaker_factory*, tsi_handshaker**)) in archive libgrpc.a
ld: error: undefined symbol: BIO_new_bio_pair
>>> referenced by ssl_transport_security.cc:1354 (src/core/tsi/ssl_transport_security.cc:1354)
>>> ssl_transport_security.cc.o:(create_tsi_ssl_handshaker(ssl_ctx_st*, int, char const*, tsi_ssl_handshaker_factory*, tsi_handshaker**)) in archive libgrpc.a
ld: error: undefined symbol: SSL_set_bio
>>> referenced by ssl_transport_security.cc:1359 (src/core/tsi/ssl_transport_security.cc:1359)
>>> ssl_transport_security.cc.o:(create_tsi_ssl_handshaker(ssl_ctx_st*, int, char const*, tsi_ssl_handshaker_factory*, tsi_handshaker**)) in archive libgrpc.a
ld: error: undefined symbol: SSL_set_connect_state
>>> referenced by ssl_transport_security.cc:1362 (src/core/tsi/ssl_transport_security.cc:1362)
>>> ssl_transport_security.cc.o:(create_tsi_ssl_handshaker(ssl_ctx_st*, int, char const*, tsi_ssl_handshaker_factory*, tsi_handshaker**)) in archive libgrpc.a
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libgrpc_csharp_ext.so] Error 1
make[1]: *** [CMakeFiles/grpc_csharp_ext.dir/all] Error 2
make: *** [all] Error 2
mindgood#minds-MacBook-Pro grpc %
How to solve this error? Please help me. Or how to compile grpc to static link library on macOS?
Thanks in advance.

This problem solved by myself,the answer is at https://github.com/android/ndk/issues/1789

Related

How to fix Veins5.2 Build Errors with Omnet++ 6.0?

I imported Veins5.2 into Omnet++ 6.0 on Windows and when building it shows the following build Error :
Creating shared library: ../out/gcc-debug/src/libveins_dbg.dll
ld-link: error: undefined symbol: __declspec(dllimport) WSAGetLastError
referenced by ////omnetpp-6.0/omnetpp-6.0/include/omnetpp/platdep/sockets.h:33
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(sock_errno())
lld-link: error: undefined symbol: __declspec(dllimport) WSAStartup
referenced by ////omnetpp-6.0/omnetpp-6.0/include/omnetpp/platdep/sockets.h:47
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(initsocketlibonce())
referenced by ../out/gcc-debug/src/veins/modules/mobility/traci/TraCIScenarioManagerForker.o
lld-link: error: undefined symbol: __declspec(dllimport) closesocket
referenced by veins/modules/mobility/traci/TraCIConnection.cc:87
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::~TraCIConnection())
referenced by veins/modules/mobility/traci/TraCIConnection.cc:127
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::connect(omnetpp::cComponent*, char const*, int))
referenced by veins/modules/mobility/traci/TraCIScenarioManagerForker.cc:152
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIScenarioManagerForker.o:(veins::TraCIScenarioManagerForker::getPortNumber() const)
lld-link: error: undefined symbol: __declspec(dllimport) inet_addr
referenced by veins/modules/mobility/traci/TraCIConnection.cc:103
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::connect(omnetpp::cComponent*, char const*, int))
lld-link: error: undefined symbol: __declspec(dllimport) gethostbyname
referenced by veins/modules/mobility/traci/TraCIConnection.cc:107
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::connect(omnetpp::cComponent*, char const*, int))
lld-link: error: undefined symbol: __declspec(dllimport) htons
referenced by veins/modules/mobility/traci/TraCIConnection.cc:119
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::connect(omnetpp::cComponent*, char const*, int))
lld-link: error: undefined symbol: __declspec(dllimport) socket
referenced by veins/modules/mobility/traci/TraCIConnection.cc:124
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::connect(omnetpp::cComponent*, char const*, int))
referenced by veins/modules/mobility/traci/TraCIScenarioManagerForker.cc:129
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIScenarioManagerForker.o:(veins::TraCIScenarioManagerForker::getPortNumber() const)
lld-link: error: undefined symbol: __declspec(dllimport) connect
referenced by veins/modules/mobility/traci/TraCIConnection.cc:126
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::connect(omnetpp::cComponent*, char const*, int))
lld-link: error: undefined symbol: __declspec(dllimport) setsockopt
referenced by veins/modules/mobility/traci/TraCIConnection.cc:147
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::connect(omnetpp::cComponent*, char const*, int))
lld-link: error: undefined symbol: __declspec(dllimport) recv
referenced by veins/modules/mobility/traci/TraCIConnection.cc:188
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::receiveMessageabi:cxx11)
referenced by veins/modules/mobility/traci/TraCIConnection.cc:210
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::receiveMessageabi:cxx11)
lld-link: error: undefined symbol: __declspec(dllimport) send
referenced by veins/modules/mobility/traci/TraCIConnection.cc:237
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::sendMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))
referenced by veins/modules/mobility/traci/TraCIConnection.cc:253
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIConnection.o:(veins::TraCIConnection::sendMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))
lld-link: error: undefined symbol: __declspec(dllimport) htonl
referenced by veins/modules/mobility/traci/TraCIScenarioManagerForker.cc:138
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIScenarioManagerForker.o:(veins::TraCIScenarioManagerForker::getPortNumber() const)
lld-link: error: undefined symbol: __declspec(dllimport) bindyour text
referenced by veins/modules/mobility/traci/TraCIScenarioManagerForker.cc:141
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIScenarioManagerForker.o:(veins::TraCIScenarioManagerForker::getPortNumber() const)
lld-link: error: undefined symbol: __declspec(dllimport) getsockname
referenced by veins/modules/mobility/traci/TraCIScenarioManagerForker.cc:146
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIScenarioManagerForker.o:(veins::TraCIScenarioManagerForker::getPortNumber() const)
lld-link: error: undefined symbol: __declspec(dllimport) ntohs
referenced by veins/modules/mobility/traci/TraCIScenarioManagerForker.cc:150
../out/gcc-debug/src/veins/modules/mobility/traci/TraCIScenarioManagerForker.o:(veins::TraCIScenarioManagerForker::getPortNumber() const)
collect2.exe: error: ld returned 1 exit status
\\omnetpp-6.0\omnetpp-6.0\tools\win32.x86_64\mingw64\bin/llvm-ar.exe: error: unable to load '../out/gcc-debug/src/libveins_dbg.dll.a': No such file or directory
make[1]: *** [Makefile:217: ../out/gcc-debug/src/libveins_dbg.dll] Error 1
make[1]: Leaving directory '///// veins-veins-5.2/veins-veins-5.2/src'
make: *** [Makefile:36: all] Error 2
"make MODE=debug -j16 all" terminated with exit code 2. Build might be incomplete.
Build Failed. 2 errors, 2 warnings. (took 36s.395ms)
Cleaned local , cleane build, still has the same issue
I had build errors also when trying to get Veins running with OMNet++ 6.0 on Windows. See the changelog here: http://veins.car2x.org/download/. Veins lists recommended versions and recommends OMNet++ 5.6.2 instead of 6.0. I had no build errors when using the recommended versions. Good luck!

get link error when use protobuf 3 in xcode

first,I installed google protobuf-3.3 (protobuf-cpp-3.3.0.tar.gz), use xcode to create a crossplatform game project, the target is ios, add libprotobuf-lite.tbd and libprotobuf.tbd, then create a test.proto file like this:
syntax = "proto3";
message Person {
string name = 1;
}
use protoc to compile it to cpp file: test.pb.h,test.pb.cc
when run the project, I got 13 errors:
Undefined symbols for architecture arm64:
"google::protobuf::Message::SpaceUsedLong() const", referenced from:
vtable for Person in test.pb.o
"google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)", referenced from:
Person::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in test.pb.o
Person::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in test.pb.o
Person::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in test.pb.o
"google::protobuf::UnknownFieldSet::default_instance()", referenced from:
google::protobuf::internal::InternalMetadataWithArena::default_instance() in test.pb.o
"google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)", referenced from:
Person::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in test.pb.o
"google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)", referenced from:
protobuf_test_2eproto::(anonymous namespace)::protobuf_RegisterTypes(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test.pb.o
...
...
...

scan business card address using dessert library but getting a linking error

I'm getting following linking error when compiled.
Undefined symbols for architecture x86_64:
"tesseract::TessBaseAPI::GetUTF8Text()", referenced from:
-[Tesseract recognizedText] in Tesseract.o
"tesseract::TessBaseAPI::SetVariable(char const*, char const*)", referenced from:
-[Tesseract setVariableValue:forKey:] in Tesseract.o
-[Tesseract loadVariables] in Tesseract.o
"tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool)", referenced from:
tesseract::TessBaseAPI::Init(char const*, char const*) in Tesseract.o
"tesseract::TessBaseAPI::Version()", referenced from:
+[Tesseract version] in Tesseract.o
"tesseract::TessBaseAPI::SetImage(unsigned char const*, int, int, int, int)", referenced from:
-[Tesseract setImage:] in Tesseract.o
"tesseract::TessBaseAPI::Recognize(ETEXT_DESC*)", referenced from:
-[Tesseract recognize] in Tesseract.o
"tesseract::TessBaseAPI::TessBaseAPI()", referenced from:
-[Tesseract initWithDataPath:language:] in Tesseract.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/Users/admin/Desktop/Screen Shot 2015-02-04 at 3.38.46 pm.png
how to resolve it.. or any other library that supports in iOS8...?

compiling litecoin OSX 10.9.1

I'm trying to compile the Litecoin source (https://github.com/litecoin-project/litecoin.git). Doing this in windows with VmWare OSX 10.9.1(64bit).
I cloned it and in terminal ran:
make -f makefile.osx USE_UPNP=-
It spits out this error:
Undefined symbols for architecture x86_64:
"boost::program_options::to_internal(std::string const&)", referenced from:
boost::program_options::detail::basic_config_file_iterator<char>::getline(std::string&) in util.o
"boost::program_options::detail::common_config_file_iterator::common_config_file_iterator(std::set<std::string, std::less<std::string>, std::allocator<std::string> > const&, bool)", referenced from:
boost::program_options::detail::basic_config_file_iterator<char>::basic_config_file_iterator(std::istream&, std::set<std::string, std::less<std::string>, std::allocator<std::string> > const&, bool) in util.o
"Db::verify(char const*, char const*, std::ostream*, unsigned int)", referenced from:
CDBEnv::Verify(std::string, bool (*)(CDBEnv&, std::string)) in db.o
CDBEnv::Salvage(std::string, bool, std::vector<std::pair<std::vector<unsigned char, std::allocator<unsigned char> >, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<std::vector<unsigned char, std::allocator<unsigned char> >, std::vector<unsigned char, std::allocator<unsigned char> > > > >&) in db.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [litecoind] Error 1
I've been googling like crazy but can't seem to find a proper solution.

Clang boost oddities

I am doing a pet project and am using clang++ (specifically MacPorts clang 3.1). So I decided to switch over to libc++ (to use std::array and such) but I was using boost (specifically asio and regex), so I had to recompile boost using libc++. I removed boost which was installed in macports and build boost from source and now is installed in /usr/local/include and /usr/local/lib. Ever since then, I cannot compile. Here are the oddities I am encountering:
When executing:
clang++ -g -std=c++11 -stdlib=libc++ -c main.cpp
I get a weird compile error having to do with the move constructor (there's more to this error, but as you can see it is coming from boost):
/usr/include/c++/v1/string:1952:10: error: overload resolution selected implicitly-deleted copy assignment operator
__r_ = _STD::move(__str.__r_);
^
/usr/include/c++/v1/string:1942:9: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign' requested here
__move_assign(__str, true_type());
^
/usr/include/c++/v1/string:1961:5: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign' requested here
__move_assign(__str, integral_constant<bool,
^
/usr/local/include/boost/regex/v4/perl_matcher.hpp:207:16: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=' requested here
s1 = traits_inst.transform(a, a + 1);
However, when I execute (please note the "-I", and it must be in that exact position):
clang++ -I -std=c++11 -stdlib=libc++ -g -c main.cpp
This compiles (but linking fails later on). Why is this? What does -I do without a path? Must -stdlib= be preceded with -I?
Now the fun part:
Even though, everything compiles now, it won't link. When executing:
clang++ main.o FTPClient.o FTPConnection.o -lboost_system -lboost_regex -std=c++11 -stdlib=libc++ -g -o cli
I get the message:
Undefined symbols for architecture x86_64:
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_", referenced from:
boost::re_detail::cpp_regex_traits_implementation<char>::lookup_collatename(char const*, char const*) const in libboost_regex.a(instances.o)
boost::re_detail::cpp_regex_traits_implementation<char>::lookup_classname_imp(char const*, char const*) const in libboost_regex.a(instances.o)
boost::re_detail::basic_regex_parser<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::fail(boost::regex_constants::error_type, long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long) in libboost_regex.a(instances.o)
boost::re_detail::cpp_regex_traits_implementation<char>::lookup_classname(char const*, char const*) const in libboost_regex.a(instances.o)
ld: symbol(s) not found for architecture x86_64
Now I am thinking maybe I a missing some -lboost flag but I am not sure what it is. What could be the reason for this?
Thanks very much!
EDIT: When looking through the logs of installing boost, I noticed this:
..failed clang-darwin.link.dll /usr/local/lib/libboost_filesystem.dylib...
clang-darwin.link.dll /usr/local/lib/libboost_regex.dylib
Undefined symbols for architecture x86_64:
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_", referenced from:
boost::c_regex_traits<char>::transform(char const*, char const*) in c_regex_traits.o
boost::c_regex_traits<char>::lookup_classname(char const*, char const*) in c_regex_traits.o
boost::c_regex_traits<char>::lookup_collatename(char const*, char const*) in c_regex_traits.o
boost::re_detail::RegExData::update() in cregex.o
boost::RegEx::What(int) const in cregex.o
boost::re_detail::pred2::operator()(boost::match_results<char const*, std::__1::allocator<boost::sub_match<char const*> > > const&) in cregex.o
boost::re_detail::cpp_regex_traits_implementation<char>::lookup_collatename(char const*, char const*) const in instances.o
...
"__ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initIPKwEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_", referenced from:
boost::c_regex_traits<wchar_t>::transform(wchar_t const*, wchar_t const*) in wc_regex_traits.o
boost::c_regex_traits<wchar_t>::lookup_classname(wchar_t const*, wchar_t const*) in wc_regex_traits.o
boost::re_detail::cpp_regex_traits_implementation<wchar_t>::lookup_collatename(wchar_t const*, wchar_t const*) const in winstances.o
boost::re_detail::cpp_regex_traits_implementation<wchar_t>::lookup_classname_imp(wchar_t const*, wchar_t const*) const in winstances.o
boost::re_detail::cpp_regex_traits_implementation<wchar_t>::lookup_classname(wchar_t const*, wchar_t const*) const in winstances.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does this mean boost regex maybe incompatible with -libc++?
EDIT 2: I tried using std::regex, but I get this:
Undefined symbols for architecture x86_64:
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::regex_traits<char>::__lookup_collatename<char const*>(char const*, char const*, char) const in main.o
unsigned int std::__1::regex_traits<char>::__lookup_classname<char const*>(char const*, char const*, bool, char) const in main.o
ld: symbol(s) not found for architecture x86_64
A helpful, but unsatisfactory answer: libc++ contains std::regex, which you can use instead of boost::regex.

Resources