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)













-1















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.










share|improve this question













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
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    Needs a Minimal, Complete, and Verifiable example if you want an actual answer.

    – Matthieu Brucher
    Mar 21 at 15:49
















-1















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.










share|improve this question













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
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    Needs a Minimal, Complete, and Verifiable example if you want an actual answer.

    – Matthieu Brucher
    Mar 21 at 15:49














-1












-1








-1








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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
If this question can be reworded to fit the rules in the help center, please edit the question.







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
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 1





    Needs a Minimal, Complete, and Verifiable example if you want an actual answer.

    – Matthieu Brucher
    Mar 21 at 15:49













  • 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













1 Answer
1






active

oldest

votes


















1














  1. 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.

  2. Different C++ compilers often have incompatible C++ libraries. This is also a big pain.

  3. I will strongly recommend to recommend you to recompile everything on the target platform.

  4. 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.





share|improve this answer








New contributor




Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














  1. 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.

  2. Different C++ compilers often have incompatible C++ libraries. This is also a big pain.

  3. I will strongly recommend to recommend you to recompile everything on the target platform.

  4. 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.





share|improve this answer








New contributor




Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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















1














  1. 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.

  2. Different C++ compilers often have incompatible C++ libraries. This is also a big pain.

  3. I will strongly recommend to recommend you to recompile everything on the target platform.

  4. 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.





share|improve this answer








New contributor




Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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













1












1








1







  1. 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.

  2. Different C++ compilers often have incompatible C++ libraries. This is also a big pain.

  3. I will strongly recommend to recommend you to recompile everything on the target platform.

  4. 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.





share|improve this answer








New contributor




Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










  1. 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.

  2. Different C++ compilers often have incompatible C++ libraries. This is also a big pain.

  3. I will strongly recommend to recommend you to recompile everything on the target platform.

  4. 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.






share|improve this answer








New contributor




Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer






New contributor




Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered Mar 21 at 16:07









Alexey GodinAlexey Godin

1644




1644




New contributor




Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Alexey Godin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • 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

















  • 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
















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





Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript