shared-libraries

How to link to a shared library without lib* prefix in a different directory? [duplicate]

喜欢而已 提交于 2019-12-17 23:13:52
问题 This question already has answers here : How to link using GCC without -l nor hardcoding path for a library that does not follow the libNAME.so naming convention? (3 answers) Closed 9 months ago . I have to link my code to a shared library without the lib prefix. (say, foo.so) The first problem is -l option does not find the file. So I tried directly including this file to the last compilation like this: gcc a a.o /PATH/TO/FOO/foo.so But in this case, a is hard linked to foo.so as an absolute

Does ldd also show dependencies of dependencies?

a 夏天 提交于 2019-12-17 22:50:37
问题 I have a binary for which ldd shows an unexpected dependency und libicuuc (from "icu"). #ldd A [...] libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007faaf9722000) libicuuc.so.49 => /usr/lib64/libicuuc.so.49 (0x00007faaf5689000) Since on this system libxml depends dynamically on libicuuc, it makes sense that ldd enventually ends up finding it, but is it expected that libicuuc also appears in the ldd output for A? Is there some command to retrieve only the libraries that are linked in as

Loading 3rd party shared libraries from an Android native activity

萝らか妹 提交于 2019-12-17 22:42:08
问题 I've built the Assimp library as a shared library. I've included it in my Android ndk project and it builds fine but when I load it I get the following error: Unable to load native library: My-Native-Activity. (Perhaps I should add that my activity works fine when the library is not included and that I've checked the apk and on the device; the library is being added to the libs folder and installed on the device in /data/data/my-app/lib.) I've done a lot of reading and it seems that the only

Receive “undefined symbol” error when loading library with dlopen

只愿长相守 提交于 2019-12-17 22:24:16
问题 I'm writing some code that uses dynamic shared libraries as plugins. My command line for building the shared libraries looks like: cc -shared -fPIC -o module.so -g -Wall module.c Within the module, I can call functions that are in any other shared library that has been loaded within the main executable. However I cannot access (exported) functions that are in the executable itself (I get undefined symbol errors). My call to dlopen looks like this: void *handle = dlopen(plugin, RTLD_NOW); Can

What is the difference between LD_LIBRARY_PATH and -L at link time?

非 Y 不嫁゛ 提交于 2019-12-17 21:52:02
问题 I'm having problems with LD_LIBRARY_PATH at link time (this question has nothing to do with run time). The link line looks like this when I run make (this is a Linux system using g++ version 4.1.x): g++ a.o b.o c.o -o myapp \ -L/long/path/to/libs/ \ -L/another/long/path/ \ -labc -ldef -lghi The -l options reference shared libraries (e.g., libabc.so) which exist in the directories specified by the -L options. Those directories also appear in LD_LIBRARY_PATH . With that configuration, the link

Linking shared library in Android project

佐手、 提交于 2019-12-17 20:31:19
问题 I need to import a single function written in a C file in an android studio project. This function call others functions located in anothers files (50+ C files and headers in total). This project already contains a single C++ file as I am using NDK to compile OpenCV4android. I've used Mingw and GCC to compile a shared libraries (libfinal.so) but once i try to import them thanks to NDKbuild i got this meaningless error : Error:Execution failed for task ':app:ndkBuild'. > Process 'command 'C:

How to do versioning of a shared library in Linux?

余生颓废 提交于 2019-12-17 19:28:24
问题 Windows provides the resource file for version information for an application and DLL. The resource file includes information like version, copyright and manufacturer. We have an shared library and like to add version information. How can we do it on Linux with a shared library? 回答1: The short version is that you do this via the soname of the library. Read chapter 3 at http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html as well as chapter 3.3 ABI Versioning at http://www.akkadia

Cannot find libcrypto library error

好久不见. 提交于 2019-12-17 18:50:23
问题 When i am trying to compile a C code which uses openssl 'crypto' library functions with comand line -lcrypto with gcc 4.4.3 it gives an error `@ubu:$ gcc -ggdb aes_m.c -Werror -Wall -I /usr/local/ssl/include/ -lcrypto -o aes /usr/bin/ld: cannot find -lcrypto collect2: ld returned 1 exit status` what can be the reason for this?? I have already gone through this discussion ld cannot find an existing library but that does not help. locate command results in $ locate libcrypto /home/abhi

Difference between using java.library.path and LD_LIBRARY_PATH

我的未来我决定 提交于 2019-12-17 18:33:16
问题 Is there a difference between setting the JVM argument -Djava.library.path=/path at JVM start and setting the Linux environment variable export LD_LIBRARY_PATH=/path before the JVM is started? What are the advantages/disadvantages of the two approaches? 回答1: The first form -Djava.library.path=/path will be handled in java bytecode level, System.loadLibrary will call Runtime.loadLibary , then will call java/lang/ClassLoader.loadLibrary . In the function call ClassLoader.loadLibrary , the

Update shared libraries without restarting processes

雨燕双飞 提交于 2019-12-17 18:27:21
问题 If my process is loading a .so library and if a new version of the library is available is it possible to switch to the new library without doing a process restart ? Or the answer depends on things like whether there is a parameter change to one of the existing functions in the library ? I am working in a pretty big system which runs 100s of processes and each loading 10s of libraries. The libraries provide specific functionality and are provided by separate teams. So when one of the library