g++ 5.5 not linking shared library [closed]C++ Dynamic Shared Library on LinuxEasy check for unresolved symbols in shared libraries?Difference between static and shared libraries?How can my .so find its dependent .so in different Ubuntu version?Difference between shared objects (.so), static libraries (.a), and DLL's (.so)?How to automatically link to dependencies of shared libraryRun-time crash on chain linked shared librariesG++ Dynamic Library Linking Issuespython ctypes link multiple shared library with example gsl gslcblasLinux Shared Library link error (undefined symbol)
What is the opposite of 'gravitas'?
What is the oldest known work of fiction?
Applicability of Single Responsibility Principle
Is a roofing delivery truck likely to crack my driveway slab?
What's the purpose of "true" in bash "if sudo true; then"
Is there an Impartial Brexit Deal comparison site?
Go Pregnant or Go Home
At which point does a character regain all their Hit Dice?
Lay out the Carpet
Why is delta-v is the most useful quantity for planning space travel?
How can I replace every global instance of "x[2]" with "x_2"
How do I keep an essay about "feeling flat" from feeling flat?
Is there any reason not to eat food that's been dropped on the surface of the moon?
Hostile work environment after whistle-blowing on coworker and our boss. What do I do?
If you attempt to grapple an opponent that you are hidden from, do they roll at disadvantage?
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
Confused about a passage in Harry Potter y la piedra filosofal
There is only s̶i̶x̶t̶y one place he can be
Greatest common substring
voltage of sounds of mp3files
What is the intuitive meaning of having a linear relationship between the logs of two variables?
Valid Badminton Score?
Products and sum of cubes in Fibonacci
Dot above capital letter not centred
g++ 5.5 not linking shared library [closed]
C++ Dynamic Shared Library on LinuxEasy check for unresolved symbols in shared libraries?Difference between static and shared libraries?How can my .so find its dependent .so in different Ubuntu version?Difference between shared objects (.so), static libraries (.a), and DLL's (.so)?How to automatically link to dependencies of shared libraryRun-time crash on chain linked shared librariesG++ Dynamic Library Linking Issuespython ctypes link multiple shared library with example gsl gslcblasLinux Shared Library link error (undefined symbol)
I'm trying to port a simple program code.cpp
linked to a couple of shared libraries libA.so
and libB.so
from my personal computer (running up-to-date Arch Linux installation) on a machine with Ubuntu 16.04 LTS. Compiling the libraries works just fine, but I get a lot undefined reference
errors when compiling code.cpp
.
I suspect this is being caused by the fact that libA.so
is linked to libB.so
, and while both libA.so
and libB.so
compile OK on Ubuntu 16.04, strangely libA.so
does not get linked against libB.so
, despite the compilation flag -lB
, which in turns causes undefined references when generating the binary. On the other hand, on Arch Linux libA.so
does get linked against libB.so
, or so ldd
tells me.
I initially though the problem could be mismatched GCC versions, but even after installing and using GCC 8 on Ubuntu 16.04 the problem persists.
c++ linker g++ shared-libraries
closed as off-topic by Mike Kinghan, Baum mit Augen♦ Mar 21 at 21:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mike Kinghan, Baum mit Augen
add a comment |
I'm trying to port a simple program code.cpp
linked to a couple of shared libraries libA.so
and libB.so
from my personal computer (running up-to-date Arch Linux installation) on a machine with Ubuntu 16.04 LTS. Compiling the libraries works just fine, but I get a lot undefined reference
errors when compiling code.cpp
.
I suspect this is being caused by the fact that libA.so
is linked to libB.so
, and while both libA.so
and libB.so
compile OK on Ubuntu 16.04, strangely libA.so
does not get linked against libB.so
, despite the compilation flag -lB
, which in turns causes undefined references when generating the binary. On the other hand, on Arch Linux libA.so
does get linked against libB.so
, or so ldd
tells me.
I initially though the problem could be mismatched GCC versions, but even after installing and using GCC 8 on Ubuntu 16.04 the problem persists.
c++ linker g++ shared-libraries
closed as off-topic by Mike Kinghan, Baum mit Augen♦ Mar 21 at 21:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mike Kinghan, Baum mit Augen
1
Needs a Minimal, Complete, and Verifiable example if you want an actual answer.
– Matthieu Brucher
Mar 21 at 15:49
add a comment |
I'm trying to port a simple program code.cpp
linked to a couple of shared libraries libA.so
and libB.so
from my personal computer (running up-to-date Arch Linux installation) on a machine with Ubuntu 16.04 LTS. Compiling the libraries works just fine, but I get a lot undefined reference
errors when compiling code.cpp
.
I suspect this is being caused by the fact that libA.so
is linked to libB.so
, and while both libA.so
and libB.so
compile OK on Ubuntu 16.04, strangely libA.so
does not get linked against libB.so
, despite the compilation flag -lB
, which in turns causes undefined references when generating the binary. On the other hand, on Arch Linux libA.so
does get linked against libB.so
, or so ldd
tells me.
I initially though the problem could be mismatched GCC versions, but even after installing and using GCC 8 on Ubuntu 16.04 the problem persists.
c++ linker g++ shared-libraries
I'm trying to port a simple program code.cpp
linked to a couple of shared libraries libA.so
and libB.so
from my personal computer (running up-to-date Arch Linux installation) on a machine with Ubuntu 16.04 LTS. Compiling the libraries works just fine, but I get a lot undefined reference
errors when compiling code.cpp
.
I suspect this is being caused by the fact that libA.so
is linked to libB.so
, and while both libA.so
and libB.so
compile OK on Ubuntu 16.04, strangely libA.so
does not get linked against libB.so
, despite the compilation flag -lB
, which in turns causes undefined references when generating the binary. On the other hand, on Arch Linux libA.so
does get linked against libB.so
, or so ldd
tells me.
I initially though the problem could be mismatched GCC versions, but even after installing and using GCC 8 on Ubuntu 16.04 the problem persists.
c++ linker g++ shared-libraries
c++ linker g++ shared-libraries
asked Mar 21 at 15:26
joaocandrejoaocandre
5051124
5051124
closed as off-topic by Mike Kinghan, Baum mit Augen♦ Mar 21 at 21:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mike Kinghan, Baum mit Augen
closed as off-topic by Mike Kinghan, Baum mit Augen♦ Mar 21 at 21:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mike Kinghan, Baum mit Augen
1
Needs a Minimal, Complete, and Verifiable example if you want an actual answer.
– Matthieu Brucher
Mar 21 at 15:49
add a comment |
1
Needs a Minimal, Complete, and Verifiable example if you want an actual answer.
– Matthieu Brucher
Mar 21 at 15:49
1
1
Needs a Minimal, Complete, and Verifiable example if you want an actual answer.
– Matthieu Brucher
Mar 21 at 15:49
Needs a Minimal, Complete, and Verifiable example if you want an actual answer.
– Matthieu Brucher
Mar 21 at 15:49
add a comment |
1 Answer
1
active
oldest
votes
- No one guarantees the complete compatibility not only between different Linux distributions, but even between different versions of the same Linux distribution. There was an attempt to unify it called LSB, but unfortunately it failed dramatically.
- Different C++ compilers often have incompatible C++ libraries. This is also a big pain.
- I will strongly recommend to recommend you to recompile everything on the target platform.
- There is ambiguity about loading shared libraries. For some systems if you link a library A which is linked with library B will make symbols of the library B available for your program. For some systems it is not so.
New contributor
Thanks for the input. But regarding 2) I have tried to use the same compiler (GCC v8) and had no success; 3) I am recompiling everything on the target machine, the issue is that the resulting shared objects exhibit different links; 4) Curiously, if I directly copylibA.so
from my original platform (correctly linked tolibB.so
), then everything works.
– joaocandre
Mar 21 at 16:13
Generally you cannot rely on it. Especially with a C++ code. Your friends here are 2 programs: ldd and nm. Check what is missing.
– Alexey Godin
Mar 21 at 16:19
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
- No one guarantees the complete compatibility not only between different Linux distributions, but even between different versions of the same Linux distribution. There was an attempt to unify it called LSB, but unfortunately it failed dramatically.
- Different C++ compilers often have incompatible C++ libraries. This is also a big pain.
- I will strongly recommend to recommend you to recompile everything on the target platform.
- There is ambiguity about loading shared libraries. For some systems if you link a library A which is linked with library B will make symbols of the library B available for your program. For some systems it is not so.
New contributor
Thanks for the input. But regarding 2) I have tried to use the same compiler (GCC v8) and had no success; 3) I am recompiling everything on the target machine, the issue is that the resulting shared objects exhibit different links; 4) Curiously, if I directly copylibA.so
from my original platform (correctly linked tolibB.so
), then everything works.
– joaocandre
Mar 21 at 16:13
Generally you cannot rely on it. Especially with a C++ code. Your friends here are 2 programs: ldd and nm. Check what is missing.
– Alexey Godin
Mar 21 at 16:19
add a comment |
- No one guarantees the complete compatibility not only between different Linux distributions, but even between different versions of the same Linux distribution. There was an attempt to unify it called LSB, but unfortunately it failed dramatically.
- Different C++ compilers often have incompatible C++ libraries. This is also a big pain.
- I will strongly recommend to recommend you to recompile everything on the target platform.
- There is ambiguity about loading shared libraries. For some systems if you link a library A which is linked with library B will make symbols of the library B available for your program. For some systems it is not so.
New contributor
Thanks for the input. But regarding 2) I have tried to use the same compiler (GCC v8) and had no success; 3) I am recompiling everything on the target machine, the issue is that the resulting shared objects exhibit different links; 4) Curiously, if I directly copylibA.so
from my original platform (correctly linked tolibB.so
), then everything works.
– joaocandre
Mar 21 at 16:13
Generally you cannot rely on it. Especially with a C++ code. Your friends here are 2 programs: ldd and nm. Check what is missing.
– Alexey Godin
Mar 21 at 16:19
add a comment |
- No one guarantees the complete compatibility not only between different Linux distributions, but even between different versions of the same Linux distribution. There was an attempt to unify it called LSB, but unfortunately it failed dramatically.
- Different C++ compilers often have incompatible C++ libraries. This is also a big pain.
- I will strongly recommend to recommend you to recompile everything on the target platform.
- There is ambiguity about loading shared libraries. For some systems if you link a library A which is linked with library B will make symbols of the library B available for your program. For some systems it is not so.
New contributor
- No one guarantees the complete compatibility not only between different Linux distributions, but even between different versions of the same Linux distribution. There was an attempt to unify it called LSB, but unfortunately it failed dramatically.
- Different C++ compilers often have incompatible C++ libraries. This is also a big pain.
- I will strongly recommend to recommend you to recompile everything on the target platform.
- There is ambiguity about loading shared libraries. For some systems if you link a library A which is linked with library B will make symbols of the library B available for your program. For some systems it is not so.
New contributor
New contributor
answered Mar 21 at 16:07
Alexey GodinAlexey Godin
1644
1644
New contributor
New contributor
Thanks for the input. But regarding 2) I have tried to use the same compiler (GCC v8) and had no success; 3) I am recompiling everything on the target machine, the issue is that the resulting shared objects exhibit different links; 4) Curiously, if I directly copylibA.so
from my original platform (correctly linked tolibB.so
), then everything works.
– joaocandre
Mar 21 at 16:13
Generally you cannot rely on it. Especially with a C++ code. Your friends here are 2 programs: ldd and nm. Check what is missing.
– Alexey Godin
Mar 21 at 16:19
add a comment |
Thanks for the input. But regarding 2) I have tried to use the same compiler (GCC v8) and had no success; 3) I am recompiling everything on the target machine, the issue is that the resulting shared objects exhibit different links; 4) Curiously, if I directly copylibA.so
from my original platform (correctly linked tolibB.so
), then everything works.
– joaocandre
Mar 21 at 16:13
Generally you cannot rely on it. Especially with a C++ code. Your friends here are 2 programs: ldd and nm. Check what is missing.
– Alexey Godin
Mar 21 at 16:19
Thanks for the input. But regarding 2) I have tried to use the same compiler (GCC v8) and had no success; 3) I am recompiling everything on the target machine, the issue is that the resulting shared objects exhibit different links; 4) Curiously, if I directly copy
libA.so
from my original platform (correctly linked to libB.so
), then everything works.– joaocandre
Mar 21 at 16:13
Thanks for the input. But regarding 2) I have tried to use the same compiler (GCC v8) and had no success; 3) I am recompiling everything on the target machine, the issue is that the resulting shared objects exhibit different links; 4) Curiously, if I directly copy
libA.so
from my original platform (correctly linked to libB.so
), then everything works.– joaocandre
Mar 21 at 16:13
Generally you cannot rely on it. Especially with a C++ code. Your friends here are 2 programs: ldd and nm. Check what is missing.
– Alexey Godin
Mar 21 at 16:19
Generally you cannot rely on it. Especially with a C++ code. Your friends here are 2 programs: ldd and nm. Check what is missing.
– Alexey Godin
Mar 21 at 16:19
add a comment |
1
Needs a Minimal, Complete, and Verifiable example if you want an actual answer.
– Matthieu Brucher
Mar 21 at 15:49