shared-libraries

Why does including -fPIC to compile a static library cause a segmentation fault at run time?

匆匆过客 提交于 2019-12-22 18:35:07
问题 I'm compiling C++ static library with g++ and using the -fPIC option. I must use the -fPIC option because eventually this library will be linked with other static libraries to form a dynamic library. When I test the static library locally, it works completely fine when I don't include the -fPIC option. But as soon as I compile the library with -fPIC, I receive a segmentation fault error at run-time when calling one of the functions. What reasons could including -fPIC to compile a static

Why does including -fPIC to compile a static library cause a segmentation fault at run time?

半腔热情 提交于 2019-12-22 18:34:22
问题 I'm compiling C++ static library with g++ and using the -fPIC option. I must use the -fPIC option because eventually this library will be linked with other static libraries to form a dynamic library. When I test the static library locally, it works completely fine when I don't include the -fPIC option. But as soon as I compile the library with -fPIC, I receive a segmentation fault error at run-time when calling one of the functions. What reasons could including -fPIC to compile a static

Keep all exported symbols when creating a shared library from a static library

跟風遠走 提交于 2019-12-22 18:04:37
问题 I am creating a shared library from a static library for which I do not have the source code. Many Stack Overflow questions provide answers on how to do that: gcc -shared -o libxxx.so -Wl,--whole-archive libxxx.a -Wl,--no-whole-archive However, some public functions of the static library are included as hidden functions in the shared library: $ nm --defined-only libxxx.a | grep __intel_cpu_indicator_init 0000000000000000 T __intel_cpu_indicator_init $ nm libxxx.so | grep __intel_cpu_indicator

symbol versioning and dlsym

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 18:04:27
问题 I load the pthread library in my program using dlopen , and fetch handlers to pthread_create and pthread_join using dlsym . How can I ensure that both the handlers are of a compatible version? I do not care if the symbols are of new version or old versions. I just want that whatever pthread_create I use to work well with the pthread_join that I get. I know there is a dlvsym to which I can pass explicit version number, but I do not care about exact version numbers as I want my code to be

Failed to linked symbol in .so file while the symbol exists

不羁岁月 提交于 2019-12-22 17:49:16
问题 I want to install lxml module in my unix system, and it doesn't work. the problem is failed to reference symbol: Python 2.6.4 (r264:75706, Sep 12 2010, 18:46:30) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> from lxml import etree Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: ld.so.1: isapython2.6: fatal: relocation error: file lxml/etree.so: symbol __xmlStructuredErrorContext: referenced symbol not found however

Can I share a mine library to all applications?

本小妞迷上赌 提交于 2019-12-22 13:57:25
问题 I have a project (.NET 4, but I can have also .NET 4.5) that always use the same DLL I've made (it's mine Data Layer, more or less). Each website it's an application. I'd like to share this Library I have to each application, so if I do an update I'll update only a "folder", and I don't need to copy/paste this Library on each Bin folder on each web application. Is it possible? Such as, if I create my class MyClass2013 , it will be available for each web application when I load Visual Studio:

libicui18n.so.52: cannot open shared object file

拟墨画扇 提交于 2019-12-22 12:26:21
问题 I have been using libicu to detect charset in my node app that runs inside of docker, ubuntu. this is done through the module node-icu-charset-detector that uses the libicu-dev package, which I install prior to the npm package. It all worked fine but I suddently get the error module.js:356 Module._extensions[extension](this, filename); ^ Error: libicui18n.so.52: cannot open shared object file: No such file or directory at Module.load (module.js:356:32) at Function.Module._load (module.js:312

How to export specific symbol from executables in GNU/Linux

旧巷老猫 提交于 2019-12-22 12:15:52
问题 While loading dynamic libraries by ::dlopen() , exporting symbols from executables can be done by -rdynamic option, but it exports all the symbols of the executable, which results in bigger binary size. Is there a way to export just specific function(s)? For example, I have testlib.cpp and main.cpp as below: testlib.cpp extern void func_export(int i); extern "C" void func_test(void) { func_export(4); } main.cpp #include <cstdio> #include <dlfcn.h> void func_export(int i) { ::fprintf(stderr, "

How to export specific symbol from executables in GNU/Linux

雨燕双飞 提交于 2019-12-22 12:15:09
问题 While loading dynamic libraries by ::dlopen() , exporting symbols from executables can be done by -rdynamic option, but it exports all the symbols of the executable, which results in bigger binary size. Is there a way to export just specific function(s)? For example, I have testlib.cpp and main.cpp as below: testlib.cpp extern void func_export(int i); extern "C" void func_test(void) { func_export(4); } main.cpp #include <cstdio> #include <dlfcn.h> void func_export(int i) { ::fprintf(stderr, "

how to investigate python2 segfault on imp.load_module

廉价感情. 提交于 2019-12-22 12:08:11
问题 I am trying to install and use dolfin on Arch Linux, with Python 2.7.3. What is the best way to find out what is causing segmentation faults such as these? $ python2 -c "import dolfin; print dolfin.__version__" [3] 6491 segmentation fault (core dumped) python2 -c "import dolfin; print dolfin.__version__" I have tried inspecting the core file through gdb: $ sudo systemd-coredumpctl gdb 6491 but they are always truncated: Reading symbols from /usr/bin/python2.7...(no debugging symbols found)..