restclient-cpp
restclient-cpp copied to clipboard
Error: Undefined symbols for architecture x86_64
Command
$ make
Environment
OSX Yosemite 10.10.2
GNU Make 3.81
gxx version 6.1.0
Error
Undefined symbols for architecture x86_64:
"RestClient::post(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)"
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
can you give some more details about your environment and the command you ran that resulted in this error?
@mrtazz updated!
do you get any errors for ./autogen.sh
or ./configure
? Did you pass any flags to configure?
Ya these both are working fine. In configure i had passed --prefix flag for storing the lib in my thirdparty directory
I have the same problem. @voidabhi your target is universal binary x86(_64) and the lib is built for x64 only. It builds OK for 64bit targets.
I apologise for the noob question - how do I build the lib for both 32 and 64bit?
oh, sorry for the long delay. I will have to check how to compile it for both architectures.
@mrtazz thanks.
It seems like you can pass -arch i386 -arch x86_64
to clang to build a multi architecture binary (as per http://stackoverflow.com/questions/6104726/trouble-building-universal-binary-with-autotools). There are also the -m flags to gcc you could try to, however this post (http://stackoverflow.com/questions/3261909/build-32bit-on-64-bit-linux-using-an-automake-configure-script) is for Linux so I'm not super confident in it working on OSX.
@nicroto @voidabhi can you give those instructions a try and see if they work for you? Happy to add an autoconf flag for this if this is all that's needed to make this work.
@mrtazz Getting same error on running cmake with above flags
cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ..
Having the same issue as him
"Undefined symbols for architecture x86_64:
"RestClient::get(std::__1::basic_string<char, std::__1::char_traits
Having also the same issue as him "Undefined symbols for architecture x86_64: "RestClient::get(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)"
@aschafers are you still having issues with the latest code? I'd like to know if this can be closed. Thanks!
Hello, I tried yesterday to use rest client on a mac and I am having exactly the same issue:
Undefined symbols for architecture x86_64:
"RestClient::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
is there any way to fix it?
I have the same problem on mac 10.15.7
Same here, is there any solution yet?
I am having the same issue on Linux with clang. It seems that this specific template instance isn't being compiled:
error: mold: error: undefined symbol: build/linux/x86_64/release/libcryptobot.a(server.cpp.o): RestClient::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
If this is the case there should be a way to make the compiler deduce this instantiation. As a matter of fact, this instance shouldn't be needed at all in my code, at least at a first glance, since I'm only calling auto REST_response = RestClient::get(json_request);
.
i have the same for arm64 on m1 macbook
Hello! I fought the decision for CMake. I use MacOS Ventura 13.4. You may add this code into your CMake:
FetchContent_Declare(
restclient
GIT_REPOSITORY https://github.com/mrtazz/restclient-cpp.git
GIT_TAG master
)
FetchContent_MakeAvailable(restclient)
FetchContent_GetProperties(restclient)
if(NOT restclient_POPULATED)
FetchContent_Populate(restclient)
endif()
list(APPEND EXTRA_LINKS
restclient-cpp )
target_link_libraries(${PROJECT_NAME}
${EXTRA_LINKS})