I'm currently linking with two third party shared libraries (A.so and B.so) on linux. the problem is that both of the two so's linked statically with another library, as a result there are about 400 functions from A.so and B.so having the same names. When I compile and link with -lA -lB, or -lB -lA, depending on the order the functions are picked up from A or B separately as a result of function interposition which caused problem and the code cannot run. I'm wondering if there's a way to bind function names to their libraries so both libraries can be linked and used? because those overlapping function names are called internally within A and B, so I can't use things like objcopy, etc. will dlopen help?
how to link with two shared libraries with many conflicting functions
4.6k Views Asked by Daniel At
1
There are 1 best solutions below
Related Questions in LINUX
- Is there some way to use printf to print a horizontal list of decrementing hex digits in NASM assembly on Linux
- Why does Hugo generate different taxonomy-related HTML on different OS's?
- Writes in io_uring do not advance the file offset
- Why `set -o pipefail` gives different output even though the pipe is not failing
- what really controls the permissions: UID or eUID?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Docker container unable to make HTTPS requests to external API
- Whow to use callback_query_handler in Python 3.10
- Create kea runtime directory at startup in Yocto image
- Problem on CPU scheduling algorithms in OS
- How to copy files into the singularity sandbox?
- Android kernel error: undefined reference to `get_hw_version_platform'
- Is there a need for BPF Linux namespace?
- Error when trying to execute a binary compiled in a Kali Linux machine on an Ubuntu system
- Issue with launching application after updating ElectronJs to version 28.0.0 on Windows and Linux
Related Questions in GCC
- File refuses to compile std::erase() even if using -std=g++23
- the difference between two style of inline ASM
- Why veneer code generated by gcc for cortex-m0 seems 8-byte aligned?
- How to compile the Linux kernel with -O0 for more detailed debug?
- GMP Windows installation "configure: error: could not find a working compiler"
- Unable to run get .exe file from assembly NASM
- Problem with compiling c++ project that is running python code using Python.h -> undefined reference
- How to use a newer linker and glibc in a Kotlin/Native project?
- "Config.guess failed to determine the host type" when trying build binutils-2.7 with Cygwin
- Trying to compile GCC returns a bunch of errors
- Compiling with gcc fno-common option causes performance degradation
- On cygwin I get errors containing -lintl and -liconv when running gcc
- Constant function pointer optimization
- How to obtain mingw-w64 version 9.3.0 or older for MSYS2?
- How to fix this error in terminal while writing hello world code in VS Code on C?
Related Questions in G++
- File refuses to compile std::erase() even if using -std=g++23
- Can't resolve undefined reference to box2D C++
- Is this a GCC optimiser bug or a feature?
- Problem with compiling c++ project that is running python code using Python.h -> undefined reference
- weird > thing when compiling for sdl2 in g++
- cmake and g++ cross compilation looking for library in host sysroot path instead of target sysroot
- g++ / vscode apparently cannot see my src folder? "cc1plus.exe: fatal error: src/glad.c No such file or directory"
- compile masstree from source in riscv64
- C++: undefined reference to `xxx`
- Problem with g++ on Mac using std::thread and exceptions
- Why is the size of the bit-field structure different from what I think?
- g++ ok but clang no: return rvalue to lvalue
- Trouble setting up c++ with VSCode. Include error, missing binary operator and xlocale.h not found
- Trying to understand the fields of std::_Sp_counted_base in gcc's bits/shared_ptr_base.h header file
- g++: fatal error: cannot execute ‘d21’: execvp: No such file or directory compilation terminated
Related Questions in SHARED-LIBRARIES
- Keep multi-version of a static-lib like what we do for shared-libs
- Link shared library through makefile
- how to test .dll on Linux
- installing 'xiaomi notes.apk' through adb on chromebook getting error
- bazel 6.5.0 build: failing to link external non-bazel shared library
- can't reference netstandard2.0 library if a reference to CodeAnalysis.CSharp is present
- HDF5 Library: Works for Running Binary but Fails to Recompile — Why?
- How to resolve the shared library of a function in core file, using GDB - when no symbols are loaded?
- How to use "APP_INITIALIZER" into a library with standalone components
- Use Conan to manage runtime dependencies
- Defining a Global Variable from Library Object
- The problem with explicitly linking the library
- The problem with the explicit dynamic library
- Linux: how can I force my process to free unloaded libraries?
- LoadLibrary error while using libtorch with ROS2
Related Questions in FUNCTION-INTERPOSITION
- Function interposition: about the use of a static function variable
- Interposition at compile time does not work
- Override a CMake function twice
- Override global function like fopen/ofstream
- Symbol interposition on macOS
- Will using DYLD_INTERPOSE for a C function in one iOS static library interpose it for all other libraries in the bundle?
- Chrome does not start when preloading read system call using LD_PRELOAD
- symbol lookup in shared libraries
- Interposing code into an existing apk
- Creating parametric equations using points
- Interposing part of a shared object by soname
- Mach Injection: System call open is not getting interposed when injecting in Excel
- malloc function interposition in the standard C and C++ libraries
- Polyfit and polyval to perform interpolation
- How to hook system calls of my android app
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
When the two libraries were linked, they should have controlled the symbols they export, and should have hidden the "other" library, but they didn't ...
Yes: if you
dlopen("A.so", RTLD_LOCAL);anddlopen("B.so", RTLD_LOCAL);, then neither library will be added to the global scope, and they will not "see" each other.You'll have to explicitly lookup symbols you need from
A.soandB.so, but that's the best you could do.Update:
This is best done by using
-fvisibility=hiddenflag and__attribute__((visibility("default")))on symbols that should be exported. Example:Without explicit export control, everything gets exported (including
InternalFunctionwe don't want).Voilà: only things we explicitly wanted to export are.