New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error "ld: cannot find -lstdc++" [Fedora Core] #1901

Closed
oneacik opened this Issue Mar 3, 2015 · 15 comments

Comments

Projects
None yet
4 participants
@oneacik
Copy link

oneacik commented Mar 3, 2015

Hi.

I'm trying to compile nupic.core and I am exactly following guide.
I gitted it from nupic.core.
Did everythink with cmake.
But on make I get following:

[root@localhost scripts]# make clean
[root@localhost scripts]# make
... LOT OF COMPILING AND LINKING ...
[ 61%] Building CXX object CMakeFiles/nupic_core_solo.dir/nupic/utils/Watcher.cpp.o
Linking CXX static library libnupic_core_solo.a
[ 61%] Built target nupic_core_solo
[ 62%] Building CXX object CMakeFiles/helloregion.dir/examples/regions/HelloRegions.cpp.o
Linking CXX executable helloregion
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
make[2]: *** [helloregion] Error 1
make[1]: *** [CMakeFiles/helloregion.dir/all] Error 2
make: *** [all] Error 2

My linux is:
Linux localhost.localdomain 3.17.7-200.fc20.x86_64 #1 SMP Wed Dec 17 03:35:33 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

gcc:
gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC)

Libraries:
/usr/lib64/libstdc++.so.6.0.19
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so - linked to 6.0.19
/usr/lib/libstdc++.so.6.0.19
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so - linked to 6.0.19

make:
GNU Make 3.82

cmake:
cmake version 2.8.12.2

any idea why is it happening?

@rhyolight rhyolight added this to the 0.2.1: release bugfixes milestone Mar 3, 2015

@rhyolight rhyolight self-assigned this Mar 3, 2015

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Mar 3, 2015

@rhyolight rhyolight changed the title Fedora, problem with compiling. Compilcation error "ld: cannot find -lstdc++" [Fedora Core] Mar 3, 2015

@rhyolight rhyolight changed the title Compilcation error "ld: cannot find -lstdc++" [Fedora Core] Compilation error "ld: cannot find -lstdc++" [Fedora Core] Mar 3, 2015

@rhyolight rhyolight modified the milestones: 0.2.1: release bugfixes, 0.3.1: installation bug fixes Mar 5, 2015

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 7, 2015

@oneacik You might have the gcc package installed but the wrong architecture, there's a i686 and a x86_64 package for each. What does rpm -q gcc-c++ libstdc++ libstdc++-devel show you?

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 7, 2015

@breznak / @david-ragazzi / @rcrowder Maybe you guys can help? I don't understand what's going on. It seems that libstdc++ is installed and working on Fedora, but I keep getting this /usr/bin/ld cannot find -lstdc++ error. Fedora doesn't seem to have a lstdc++ package available via yum.... just libstdc++. What's the difference?

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 7, 2015

@rcrowder

This comment has been minimized.

Copy link
Contributor

rcrowder commented Apr 8, 2015

I spun up a 64bit Fedora VM at lunchtime (with 64bit Windows 7 host OS).
But could only get as far as the following known issue (that may have been
resolved);

ltol: fatal error: bytecode stream generated with LTO version 2.2 instead
of the expected 3.0

Never got to the stdc++ link error :(

On Tue, Apr 7, 2015 at 6:08 PM, Matthew Taylor notifications@github.com
wrote:

Here is a relevant thread about this problem
http://forums.fedoraforum.org/showthread.php?t=281417, but it doesn't
help. :/


Reply to this email directly or view it on GitHub
#1901 (comment).

@breznak

This comment has been minimized.

Copy link
Member

breznak commented Apr 8, 2015

tol: fatal error: bytecode stream generated with LTO version 2.2 instead
of the expected 3.0

I've seen this err, search for it in the Issues.

1/ try compiling without LTO
2/ what compiler version are you using? gcc-4.8 is a safe choice.

@rcrowder

This comment has been minimized.

Copy link
Contributor

rcrowder commented Apr 8, 2015

I only had time to install the bare minimum applications, all from
defaults. So G++ is 4.9.x Will try downgrading to 4.8 tomorrow, and chase
up the LTO issue.

On Wed, Apr 8, 2015 at 5:14 PM, breznak notifications@github.com wrote:

tol: fatal error: bytecode stream generated with LTO version 2.2 instead
of the expected 3.0

I've seen this err, search for it in the Issues.

1/ try compiling without LTO
2/ what compiler version are you using? gcc-4.8 is a safe choice.


Reply to this email directly or view it on GitHub
#1901 (comment).

@breznak

This comment has been minimized.

Copy link
Member

breznak commented Apr 8, 2015

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 8, 2015

The OP's environment is gcc 4.8 though. And when I spun up my Fedora, I installed the latest gcc (4.9) and did not run into the LTO problem, strangely. I ran right into the OP's problem.

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 8, 2015

Oh, and thanks for the assistance! 😄

@rcrowder

This comment has been minimized.

Copy link
Contributor

rcrowder commented Apr 9, 2015

I git cloned the core, and face the exact same issue as OP. Currently have;
gcc-c++-4.9.2-6.fc21.x86_64
libstdc++-4.9.2-6.fc21.x86_64
libstdc++-devel-4.9.2-6.fc21.x86_64

uname - Linux localhost.localdomain 3.17.4-301.fc21.x86_64 ...
gcc and g++ versions both 4.9.2 20150212 (Red Hat 4.9.2-6)
cmake uses ld.gold and sets up for Linux GNU local compilation

As we know 4.7 and 4.9 are having issues. Ran out of lunchtime, but need to investigate the static linking; http://www.trilithium.com/johan/2005/06/static-libstdc/

Note: Core lib builds (just like OP), but the examples and unit test fail to link. Which hopefully points to static/dynamic issues.

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 9, 2015

Thanks for the investigation, Richard. I wish I knew more about C linking 😜

@rcrowder

This comment has been minimized.

Copy link
Contributor

rcrowder commented Apr 28, 2015

@rhyolight I managed to get further with this today, trying to test compile the TM code in a Fedora 64bit VM. It looks like Fedora, with GCC 4.9.2, doesn't ship with static libstdc++ So I had to run the following to get the static libraries;

sudo yum install libstdc++.x86_64
sudo yum install libstdc++-devel.x86_64
sudo yum install libstdc++-static.x86_64

The last one is the key one. The others may already be installed by default. You can use sudo yum search libstdc++ to see the matching packages.
@oneacik @breznak If this issue still persists, can you try the install above.

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 28, 2015

Great, thanks @rcrowder.

@oneacik Please try the yum commands above and reinstall. Let me know what happens.

@rhyolight rhyolight removed the priority:2 label Apr 28, 2015

@rhyolight

This comment has been minimized.

Copy link
Member

rhyolight commented Apr 29, 2015

@oneacik Please try the suggestion above. I'll probably close this ticket by Friday if I don't hear from you.

@rhyolight rhyolight closed this May 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment