shared-libraries

dyld: Library not loaded, Reason: image not found

坚强是说给别人听的谎言 提交于 2019-11-27 14:24:21
问题 I used gdb normally until this week. Now running gdb I see: (gdb) r Starting program: /Volumes/MyProg dyld: Library not loaded: @rpath/libCore.so Referenced from: /Volumes/MyProg Reason: image not found (gdb) How to fix it? I have: OSX 10.9 GNU gdb (GDB) 7.6 installed with MacPorts P.S. I have reinstalled gdb and Xcode. This does not help. I see a lot of questions about dyld issues, but obviously I lack experience with libraries on OSX, and they appears to be useless for me. For example this

Accessing main program global variables from a dlopen()ed dynamic library in C on OS X

岁酱吖の 提交于 2019-11-27 14:22:01
问题 I am maintaining a small application that has some plugin-like functionality, which is implemented through runtime-loaded dynamic modules. Specifically, since it's a Gtk+ app, I'm using gmodule, but the question applies to dlfcn.h / dlopen() based dynamic library loading just as well. My main program has a single, global struct variable holding some global information. I want this information to be available to functions defined in the dynamically loaded plugins. On Linux, I could just refer

What does exactly the warning mean about hidden symbol being referenced by DSO?

你说的曾经没有我的故事 提交于 2019-11-27 13:53:46
I have a problem linking some shared library with g++. It gives me a warning like: hidden symbol XXX in YYY is referenced by DSO /usr/lib/... I've read some related questions about particular problems, but I want to understand it in a whole - what does this warning mean and what is a cause: What is DSO? What is a hidden symbol? How can it be referenced, if it's hidden? What is a DSO? A DSO is a Dynamic Shared Object , or less formally a shared library . What is a hidden symbol? A hidden symbol is a symbol (i.e. name of function or data object) that has been compiled with hidden linkage , e.g.

Executing a shared library on Unix

Deadly 提交于 2019-11-27 13:16:32
Some Unix shared libraries provide an output when called from the command line as if they were executables. For example: $ /lib/libc.so.6 GNU C Library stable release version 2.13, by Roland McGrath et al. Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.5.2. Compiled on a Linux 2.6.37 system on 2011-01-18. [...] In a shared library of my own written in C, how can I provide this output? I've executed now a library I

CMake: How to create alias for installing different targets?

霸气de小男生 提交于 2019-11-27 13:12:03
问题 Suppose that I've got the following libraries: add_library(myLib_static STATIC ${SRC_FILES}) add_library(myLib SHARED ${SRC_FILES}) # installing header files install(FILES ${H_FILES} DESTINATION ${INSTDIRHEADER}) # installing binaries install(TARGETS myLib_static DESTINATION ${INSTDIRBIN}) install(TARGETS myLib DESTINATION ${INSTDIRBIN}) If I execute the following command, both shared and static libraries will be installed: make install How can I have separate install commands for each of

How to build GSL with msvc2010?

旧时模样 提交于 2019-11-27 13:05:23
问题 I'm working with Qt 4.8.3 and QtCreator, which I've compiled with msvc2010 as per the instructions here. Now however I need to link to GSL (Gnu Scientific Library), but currently I only know how to build it with g++ which produces linker errors just as described here, undoubtedly for the reason given in the answer by @EvanTeran. However, in my case, building Qt with g++ via cygwin is probably not an option--I've just come off a multi-day nightmare during which I tried to do just this, but

Android NDK - make two native shared libraries calling each other

妖精的绣舞 提交于 2019-11-27 12:59:48
问题 Wasted half a day trying to build two shared libraries, e.g. mod1 and mod2 (which Android NDK compiles to libmod1.so and libmod2.so ), from sources in a jni folder and sub-folders, then have mod1 call a function from mod2. Plenty of answers on how to make the build work, but then runtime dynamic linking was not working, the app crashed on startup. Decided to post this question and immediately answer it, so that Q and A to the whole process are together, and hopefully someone else won't waste

building and linking a shared library

非 Y 不嫁゛ 提交于 2019-11-27 12:52:01
im trying to build a shared library on a windows cygwin platform using g++, and later link it with another cpp file: i use the following commands: // generate object file g++ -g -c -Wall -fPIC beat11.cpp -o beat11.o // to generate library from the object file g++ -shared -Wl,-soname,libbeat.so.1 -o libbeat.so.1.0.1 beat11.o -lc // to link it with another cpp file; -I option to refer to the library header file g++ -L. -lbeat -I . -o checkbeat checkbeat.cpp while linking, the following error crops up: /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -llibbeat.so.1

CMake warnings under OS X: MACOSX_RPATH is not specified for the following targets

大憨熊 提交于 2019-11-27 12:17:16
问题 I try to build a CMake-based software under OS X (Yosemite) which can be built successfully under Fedora 21. It uses a bunch of libraries. Both, big open ones like Boost and some self-written ones lying in /installation_folder/lib. I use CMake version 3.3.0. After executing mkdir build cd build cmake .. -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/5.2.0/bin/gcc-5 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/5.2.0/bin/g++-5 -DCMAKE_MODULE_PATH=${PWD}/../external/install/share/llvm/cmake I get the

library path when dynamically loaded?

强颜欢笑 提交于 2019-11-27 11:51:08
How can I get the path of the shared library from within the library itself? In other words, let's say that library X is loaded using dlopen() , how can I get access to the path that was used to load the said library from within the library itself? Note that I cannot have the agent that loaded the library in the first place hand me this parameter. UPDATED: Here is way that works with static variables: std::string wdir; namespace { class dynamic_library_load_unload_handler { public: dynamic_library_load_unload_handler(){ Dl_info dl_info; dladdr((void *) NP_Initialize, &dl_info); std::string