After fpm update I started getting /usr/bin/ld: cannot find -lstdc++. So, as a new practitioner I started doing my homework:
I checked if GNU Standard C++ Library is installed. Yes, it is.
I searched in the internet for solution.
I read quite few topics checking folders, files, links, etc one by one
So far, I lost 55 min.
I tried to imagine what it would be wrong. 5 min
I noticed that libstdc++6 and libstdc++-9-dev are installed.
I shew that libstdc++-10-dev is also available, too.
I decided to install it.
After one hour of “anger” I managed to have my files compiled and linked again.
Q1: Is there any option that could be added to make the error more verbose? For example, version 10 required; version improper; version mismatch; etc.
When I install a package, the package manager resolves any dependencies problem automatically. Otherwise, it gives an error with the reason why dependencies cannot be resolved. Q2: Is there something similar for the linker?
It is like having an alarm in my car that wheels are missing, but the actual problem is the size of the tire in wheels which is not the correct one. Tia
First, what is the command you ran, in order to get the /usr/bin/ld: cannot find -lstdc++ error message ? fpm update (I doubt) ? fpm build (more likely) ?
Next, what is your system/OS ? Linux ? MacOS ? some BSD ? (I exclude Windows as /usr/bin/ld isn’t a Windows path)
Assuming the problem is with fpm build, you could try the following: fpm build --verbose --flag '-v'
The first flag --verbose asks fpm to be verbose, the second argument --flag '-v' asks fpm to pass -v to the fortran compiler. If your fortran compiler is gfortran you should also get verbose output from gfortran itself.
Assuming the problem is with fpm build, you could try the following: fpm build --verbose --flag '-v'
I have uninstalled libstdc++-10-dev to test that.
After fpm build --profile "debug" --verbose --flag '-v'
I get a huge number of lines and unfortunately in the end:
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
<ERROR> Compilation failed for object "spas "
<ERROR>stopping due to failed compilation
STOP 1
No any other info requesting an extra (newer) libstdc++-xx-dev library.
Unfortunately, I have reinstalled libstdc++-10-dev to continue my work. Even if there is something traceable in the text, it is actually and practically “useless”. The essential (error) information should be near/next the last lines to be easily discoverable and readable AND displayed in the main error text.
The 2nd main purpose of this message is the current problem to be easily discoverable in this group because when I tried to search here, I did not get any related topic.
It looks like you need to specify the version of stdc++, like stdc++-6 (link=['stdc++-6']).
fpm doesn’t currently handle different distribution names of linked libraries very well. Or you can use softlinks to create a link to stdc++ for stdc++-6.
@zoziha Since this happened after fpm update I think that a make file, or something similar, of an updated package, may imposed such a rule. I say maybe.