Topic: SF/Linux static linking difficulty
With:
Linux Mint 18
64-bit
SF 2.9
I have a large program, which compiles and links, apparently successfully.
It I try
DYNAMIC LINKING
(1) linking with Options > Project > Linker :
[ ] All static
[ ] Static Fortran runtime
[ ] Static C runtime
[ ] Static C++ runtime
[x] Build import library
or
(2) linking with Options > Project > Linker :
[ ] All static
[x] Static Fortran runtime
[ ] Static C runtime
[ ] Static C++ runtime
[ ] Build import library
..then linking succeeds both times, but I can't run the executable. The console reports an error when loading shared object files, specificaly that it can't find libdislin.so.10.
I believe I can fix this by using ldconfig to add shared library libdislin.so.10 to the cached list of shared object files.
This is not what I'm asking about.
STATIC LINKING
(3) linking with Options > Project > Linker :
[x] All static
[ ] Static Fortran runtime
[ ] Static C runtime
[ ] Static C++ runtime
[ ] Build import library
..then linking fails, giving a three warnings about statically linked applications requiring at runtime the shared libraries from the glibc version used for linking, plus a large number of errors due to undefined references.
I have searched briefly for information about this. Here is some of what I've found:
- glibc uses libnss to support a number of different providers for address
resolution services. Unfortunately, you cannot statically link libnss, as exactly
what providers it loads depends on the local system's configuration
- there is a solution: you can use musl library to replace glibc. To use musl,
you can either install it and build your software using musl-gcc, or you can
use a Linux distribution that uses musl, e.g. Alpine Linux.c.
- a lot of stuff about hoiw to solve static linking, which I did not understand.
Any suggestions, anyone?
---
John