I am building a static library and I am trying to strip all of the non-public routines but I get this error:
strip: not stripping symbol `g722_state_update' because it is named in a relocation
How can I resolve this?
When I build and strip the shared version of my library I do not get this error.
Related
I'm trying to get Libcurl working in my VC++ project on VS2013 Community. I've been toiling with this for many hours, and I've tried essentially everything on Stack and Google about it, to no avail.
My most recent attempt was sparked by this answer, that mentions libcurl as a Nuget package. This is good, because it comes with all of the .lib files required. I have however run into the same problem as this fellow, in that I'm getting a linker error.
I'm importing the following libraries as 'Additional Dependencies' in the Project Configuration settings under Linker -> Input:
libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib;
Obviously, each one of these .lib files is in a different directory inside the nuget package folder inside the project folder, so under Linker -> General my 'Additional Library Directories' is set to:
"PATHTOPROJECT\packages\curl.7.30.0.2\build\native\lib\v110\x64\Release\static";
"PATHTOPROJECT\packages\zlib.1.2.8.1\build\native\lib\v110\Win32\Release\static\cdecl";
"PATHTOPROJECT\packages\openssl.1.0.1.21\build\native\lib\v110\x64\Release\static\cdecl";
"PATHTOPROJECT\packages\libssh2.1.4.3.1\build\native\lib\v110\x64\Release\static\cdecl";
I am trying to use static libraries, because I don't want to drag .dll's with my project executable if I can avoid it. It's also worth noting that my most recent attempt at using libcurl also includes SSL and whatnot, but I don't actually need those extras. Really, I just need a static libcurl library, but I can't find or compile one it seems.
In my code, I'm also using this include: #include "curl/curl.h"
I've also added the Additional Include directory correctly under 'Additional Include Directories' under C/C++ -> General:
PROJECTPATH\packages\curl.7.30.0.2\build\native\include
Now, this all compiles fine as long as I don't try and use curl in the project code.
So, the errors when I do try and use curl in the code:
CURL *curl;
curl = curl_easy_init();
That piece of code generates these errors:
1>Main.obj : error LNK2028: unresolved token (0A000453) "extern "C" void * __cdecl curl_easy_init(void)" (?curl_easy_init##$$J0YAPAXXZ) referenced in function "private: class System::String ^ __clrcall Project::Main::CurlRequest(class System::String ^,class System::String ^,class System::String ^,class System::String ^)" (?CurlRequest#Main#Project##$$FA$AAMP$AAVString#System##P$AAV34#000#Z)
1>Main.obj : error LNK2019: unresolved external symbol "extern "C" void * __cdecl curl_easy_init(void)" (?curl_easy_init##$$J0YAPAXXZ) referenced in function "private: class System::String ^ __clrcall Project::Main::CurlRequest(class System::String ^,class System::String ^,class System::String ^,class System::String ^)" (?CurlRequest#Main#Project##$$FA$AAMP$AAVString#System##P$AAV34#000#Z)
There is of course more to my curl using code, but that bare minimum shows the basics of the linking error. What can I do to fix this? As I mentioned before I've tried a whole range of solutions, some of which I'll list below:
Many answers to the questions regarding problems using libcurl in VS projects mention downloading libcurl from http://curl.haxx.se/latest.cgi?curl=win32-devel-msvc, but that link doesn't work as of now, so I can't use it.
More answers say to just compile libcurl from source. The source comes with .vcproj files, none of which compile for me without hundreds of errors, so that's out.
Solved.
This Github project is a .bat file that downloads the libcurl source, compiles it, and makes the libraries (both static and dynamic). Importing the static library created by this (libcurl_a.lib) and using it in my project along with the include directory has worked.
I'll leave this question with an unaccepted answer in case someone can provide other helpful steps that would have fixed the problem I had in using the nuget package installation.
Finally.
I am getting this error when I try to run my project with the lib webkit shared library
The whole error is
symbol lookup error: ./lib/libwebkit-1.0.so.2: undefined symbol:
UCNV_FROM_U_CALLBACK_ESCAPE_44
I just want to look for what might cause this error as I didn't find anything useful on google to tell me what is the problem right now.
It turn out that when I recompile my ICU library "properly" it worked again
I get the following error when I try to compile the pjsip libraries in the Blackberry 10 IDE:
libpj-i486-pc-nto-qnx8.0.0.a(sock_bsd.o): undefined reference to symbol 'send##libsocket.so.2'
'send##libsocket.so.2' is defined in DSO /home/f3795594/bbndk/target_10_0_9_386/qnx6/x86/lib/libsocket.so.3 so try adding it to the linker command line
Has anybody come across this error? I know it's to do with the libsocket library but not sure where to begin.
Thanks
Simple insertion into linking process:
Add the following library:
LIBS += /Applications/bbndk/target_10_0_9_386/qnx6/x86/lib/libsocket.so.3
My limited c compile knowledge got in the way.
I am in the middle of integrating UA into my Phonegap/iOS application using the UA Phonegap plugin https://github.com/urbanairship/phonegap-ua-push.
Unfortunately, I can not get it to work. Even the sample project fails to build. The problem is a duplicate symbol during linking. Please note: i did not include any additional headers, libs, etc. I am just trying to build the iOS sample project.
The clashing symbol seems to be rooted in the ASI* (ASIHttpRequest, ASIAuthenticationDialog, etc) library, which has been integrated into UA. Surprisingly, the clashing happens between both UA libs (libUAirship-1.3.2.a and libUAirshipPush-1.3.2.a).
Linker output: ld: duplicate symbol _OBJC_METACLASS_$_UA_ASIAutorotatingViewController in /Users/b/Downloads/urbanairship-phonegap-ua-push-9b7a89b/ios-sample/Airship/libUAirshipPush-1.3.2.a(UA_ASIAuthenticationDialog.o) and /Users/b/Downloads/urbanairship-phonegap-ua-push-9b7a89b/ios-sample/Airship/libUAirship-1.3.2.a(UA_ASIAuthenticationDialog.o) for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can this happen?
This issue appeared for me when I add the flag "-ObjC" in my target settings at "Other Linker Flags".
Check it, i need the flag for an another library but if it's not your case...
I'm having a linking problem. I need to link against a shared library libfoo.so that depends on a function read which I would like to define myself in the file read.c.
I compile and link everything together but at runtime I get the error
/home/bar/src/libfoo.so: undefined symbol: sread.
nm reports the symbol is defined
$nm baz | grep sread
00000000000022f8 t sread
but ldd reports the symbol is undefined
$ldd -r baz | grep sread
undefined symbol: sread (/home/bar/src/libfoo.so)
What gives? Is there some isse with the fact that libfoo.so is a shared library?
First, defining a function called 'read' is a bad idea(TM), because it is a standard libc function on all UNIXen. The behavior of your program is undefined when you do this.
Second, the read function you defined in libbaz.so is marked with a 't' in nm output. This means that this function is local (not visible outside libbaz.so). Global functions are marked with 'T' by nm.
Did you use 'static int read(...)' when you defined it in read.c?
If not, did you use a linker script, or attribute((visibility(hidden))), or perhaps -fvisibility=hidden on command line when you compiled and linked libbaz.so?
The above error can also occur when C code is compiled with G++, and then linked. G++ performs name mangling, so the actual symbol may be something like "_Zsds_[function_name]_", causing the linker to choke when it searches for the un-mangled name.
I ran into the same behavior today, except my issue was resolved following the actions outlined on Wikipedia. Basically, C code compiled with a C++ compiler will have a "mangled" name in the symbol table, causing C-style symbol resolution to fail.
When you build your shared library you need to resolve all undefined symbols from either within the same library or another (shared) library. The linker will not resolve an undefined symbol from a library with a symbol from your application.