shared-libraries

python pip specify a library directory and an include directory

删除回忆录丶 提交于 2019-11-27 00:02:16
I am using pip and trying to install a python module called pyodbc which has some dependencies on non-python libraries like unixodbc-dev, unixodbc-bin, unixodbc. I cannot install these dependencies system wide at the moment, as I am only playing, so I have installed them in a non-standard location. How do I tell pip where to look for these dependencies ? More exactly, how do I pass information through pip of include dirs (gcc -I) and library dirs (gcc -L -l) to be used when building the pyodbc extension ? pip has a --global-option flag You can use it to pass additional flags to build_ext . For

Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?

ぐ巨炮叔叔 提交于 2019-11-26 23:52:57
I have some code that uses some shared libraries (c code on gcc). When compiling I have to explicitly define the include and library directories using -I and -L, since they aren't in the standard places. When I try to run the code, I get the following error: ./sync_test ./sync_test: error while loading shared libraries: libsync.so: cannot open shared object file: No such file or directory However, do the following, everything works just fine: export LD_LIBRARY_PATH="/path/to/library/" ./sync_test Now, the strange part is, this only works once. If I try and run sync_test again I get the same

What's the difference between -rpath and -L?

爱⌒轻易说出口 提交于 2019-11-26 23:49:44
gcc and ld provide many ways to specify a search path for libraries—among them the -rpath and -L flags. The manpages reveal no differences between these two flags, effectively saying each flag adds a library to the library search path. Yet it seems strange that both flags do exactly the same thing. What are the differences, if any, between these two options? You must be reading some outdated copies of the manpages (emphasis added): -rpath=dir Add a directory to the runtime library search path. This is used when linking an ELF executable with shared objects. All -rpath arguments are

How to create a shared library with cmake?

假如想象 提交于 2019-11-26 23:45:39
问题 I have written a library that I used to compile using a self-written Makefile, but now I want to switch to cmake. The tree looks like this (I removed all the irrelevant files): . ├── include │ ├── animation.h │ ├── buffers.h │ ├── ... │ ├── vertex.h │ └── world.h └── src ├── animation.cpp ├── buffers.cpp ├── ... ├── vertex.cpp └── world.cpp So what I am trying to do is just to compile the source into a shared library and then install it with the header files. Most examples that I have found

Can a Singleton Class inside a DLL be shared across processes?

心已入冬 提交于 2019-11-26 23:08:40
问题 I am creating a custom .net hardware framework that will be used by other programmers to control some hardware. They will add a reference to our DLL to get to our hardware framework. I am in need of a shared class that will be accessed from multiple applications (processes). The singleton pattern seems to be what I need but it only works for multiple threads inside your process. I could be completely wrong but here is an example of the C# code I currently have. I can't help to feel that the

undefined reference to symbol even when nm indicates that this symbol is present in the shared library

我怕爱的太早我们不能终老 提交于 2019-11-26 23:01:03
问题 What could be wrong here? I have the following simple class: #include "libmnl/libmnl.h" int main() { struct mnl_socket *a = mnl_socket_open(12); } And after running a simple gcc compile ( gcc -lmnl main.c ) I get the following errors: /tmp/cch3GjuS.o: In function `main': main.c:(.text+0xe): undefined reference to `mnl_socket_open' collect2: ld returned 1 exit status Running nm on the shared library shows that it's actually found: aatteka@aatteka-Dell1:/tmp$ nm -D /usr/lib/libmnl.so | grep mnl

Is there an elegant way to avoid dlsym when using dlopen in C?

廉价感情. 提交于 2019-11-26 22:59:26
问题 I need to dynamically open a shared library lib.so if a specific condition is met at runtime. The library contains ~700 functions and I need to load all their symbols. A simple solution is to define the function pointers to all symbols contained in lib.so , load the library using dlopen and finally get the addresses of all symbols using dlsym . However, given the number of functions, the code implementing this solution is very cumbersome. I was wondering if a more elegant and concise solution

How to add crosswalk webview in my own android library module?

久未见 提交于 2019-11-26 22:53:25
I am in the development of an Android library module which has to include Crosswalk Webview. I create the library using Github Sonatype ( https://github.com/sonatype/ ). It works fine without Crosswalk Webview. I tried the following 3 methods to include Crosswalk. Method 1: Add Crosswalk Webview library in my library project app gradle Error : (Compile error) Failed to resolve: org.xwalk:xwalk_core_library:18.48.477.13 Method 2: Add crosswalk aar file in my library project Reference link for adding aar file How to import a .aar file into Android Studio 1.1.0 and use it in my code I have

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

蹲街弑〆低调 提交于 2019-11-26 22:41:54
问题 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

What is the 'soname' option for building shared libraries for?

≡放荡痞女 提交于 2019-11-26 22:31:28
问题 I learned the " Program Library HOWTO ". It mention that using soname to manage the version like follow. gcc -shared -fPIC -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0.0 foo.c ln -s libfoo.so.1.0.0 libfoo.so.1 ln -s libfoo.so.1 libfoo.so And I get the information that if the soname is not set. it will be equal to libfoo.so.1.0.0 ,see the answer from here. And I find that it also can work without soname , like following gcc -shared -fPIC -o libfoo.so.1.0.0 foo.c ln -s libfoo.so.1.0.0 libfoo.so.1