shared-libraries

Linux capabilities (setcap) seems to disable LD_LIBRARY_PATH

ε祈祈猫儿з 提交于 2019-11-27 19:03:10
I use LD_LIBRARY_PATH to set the path of a certain user library for an application. But if I set capabilities on this application sudo setcap CAP_NET_BIND_SERVICE=eip myapplication then LD_LIBRARY_PATH seems to be ignored. When I launch the program, Linux complains that it cannot find a certain shared library. I guess that there's some kind of protection kicking in, to prevent applications with extended rights from being hijacked. Is there a workaround? As already stated in other answers, this behavior is intended. There is some kind of workaround if you can compile (or at least link) the

std::atomic library dependency (gcc 4.7.3)

假如想象 提交于 2019-11-27 18:47:30
问题 I've been trying to compile with std::atomic, and I'm getting unresolved references to __atomic_load, __atomic_store, and __atomic_store_16. I know in a later version of gcc (4.8+?) you include -latomic, but I'm compiling with gcc 4.7.3; I've tried adding -latomic_ops and -latomic_ops_gpl, but neither seem to do much. I am installing gcc 4.8.1 now, but I do have a release platform that'll really need to be compiled for 4.7.3. Many thanks. Edit: Ok, here's some code that results in the problem

g++: In what order should static and dynamic libraries be linked?

烂漫一生 提交于 2019-11-27 18:33:48
Let's say we got a main executable called "my_app" and it uses several other libraries: 3 libraries are linked statically, and other 3 are linked dynamically. In which order should they be linked against "my_app"? But in which order should these be linked? Let's say we got libSA (as in Static A) which depends on libSB, and libSC which depends on libSB: libSA -> libSB -> libSC and three dynamic libraries: libDA -> libDB -> libDC ( libDA is the basic, libDC is the highest) in which order should these be linked? the basic one first or last? g++ ... -g libSA libSB libSC -lDA -lDB -lDC -o my_app

How to share global variables in a shared library(.so) across instances of the same process that use the shared library in Linux?

独自空忆成欢 提交于 2019-11-27 18:27:16
问题 I have a shared library(.so) that I preload before executing an application and I have a few global data structures in the shared library that the application uses. The application can create other processes say using fork() and these processes can update the global data structures in the shared library. I would like to keep a consistent view of these global data structures across all the processes. Is there any way I can accomplish this in Linux? I have tried using shm_* calls and mmap() to

How can a shared library (.so) call a function that is implemented in its loading program?

我的梦境 提交于 2019-11-27 18:12:17
I have a shared library that I implemented and want the .so to call a function that's implemented in the main program which loads the library. Let's say I have main.c (executable) which contains: void inmain_function(void*); dlopen("libmy.so"); In the my.c (the code for the libmy.so) I want to call inmain_function : inmain_function(NULL); How can the shared library call inmain_function regardless the fact inmain_function is defined in the main program. Note: I want to call a symbol in main.c from my.c not vice versa which is the common usage. You'll need make a register function in your .so so

How to link a specific version of a shared library in makefile without using LD_LIBRARY_PATH?

我与影子孤独终老i 提交于 2019-11-27 18:10:46
问题 I know that LD_LIBRARY_PATH is evil and it's a good habit to avoid using it. I have a program called server.c on a remote Solaris 9 server that holds two versions of openssl library (0.9.8 and 1.0.0) and I'm using gcc 3.4.6. My program need to link to 1.0.0a version. Because it's work environment, I don't have the right to modify anything in the openssl library directory. I figured out to compile my program with both -L and -R options without setting LD_LIBRARY_PATH and it worked fine. (I

What is a file with extension .a?

旧巷老猫 提交于 2019-11-27 17:56:47
I downloaded this: https://github.com/mongodb/mongo-c-driver And now I'm trying to use it inside my C program, but I don't know what to do with the generated .a files. What are they? I couldn't find any information, not even in the GCC manual. And I built it like so: scons --c99 Also, can I use C99 libraries with my C89 program? .a files are static libraries typically generated by the archive tool . You usually include the header files associated with that static library and then link to the library when you are compiling. Sriram .a files are created with the ar utility, and they are libraries

Is global variable in a shared library / dll, shared across process

╄→尐↘猪︶ㄣ 提交于 2019-11-27 17:53:21
问题 I am developing a shared library(.so) and dll. I have a global variable which is updated in multiple threads. So I have mutex lock for synchronization. I am not clear whether global data in shared library is shared across process. If it is then I need to use semaphores for synchronization. As I understand global variables are part of data segment so I wanted to understand how dll manages the global data across processes. Any information w.r.t. dll format and segment will be helpful. Thanks.

Android - Could not find google-play-services_lib.apk! error

痞子三分冷 提交于 2019-11-27 17:38:32
问题 I am trying to use the new Google Play Services for Google Plus integration from this link: http://ankitthakkar90.blogspot.sg/2013/05/google-plus-integration-in-android.html I was able to get everything right except when i try to run it, it provide me with this error Android Launch! adb is running normally. Performing com.anky.googleplus.MainActivity activity launch Automatic Target Mode: using device 'CB5A1MQW4P' Uploading GooglePlusDemo.apk onto device 'CB5A1MQW4P' Installing GooglePlusDemo

Is /usr/local/lib searched for shared libraries?

99封情书 提交于 2019-11-27 17:23:20
Is /usr/local/lib searched for shared libraries ? I have this error: [Leo@chessman ~]$ whereis ffmpeg ffmpeg: /usr/local/bin/ffmpeg [Leo@chessman ~]$ ffmpeg ffmpeg: error while loading shared libraries: libavcore.so.0: cannot open shared object file: No such file or directory [Leo@chessman ~]$ ls /usr/local/lib/libav* /usr/local/lib/libavcodec.a /usr/local/lib/libavfilter.a /usr/local/lib/libavcodec.so /usr/local/lib/libavfilter.so /usr/local/lib/libavcodec.so.52 /usr/local/lib/libavfilter.so.1 /usr/local/lib/libavcodec.so.52.108.0 /usr/local/lib/libavfilter.so.1.74.0 /usr/local/lib/libavcore