digifuzzy Posted November 5, 2014 Report Share Posted November 5, 2014 With a shiney new install, I wanted to get back to coding "stuff". For reasons related to a non-funtoo project, I wanted to use the regex feature from c++11. I dug into my folders to find a sample I had where regex was used. Little did I know the headache I was heading into... The sample I used was taken from cppreference. Nothing complicated about it. Previous Linux had gcc 4.9.1 and the sample compiled just fine. I realized my Funtoo only had gcc 4.8.x so was not capable of dealing with c+11 features. But I did have the latest clang/llvm installed. Short story, it did not work. A fail of truly epic proportions. First I got errors about missing references to <iostream> (WTF?). I threw in the -stdlib=libc++. Fixed that problem - moving on. I then got issues with undefined references to "std::xxxxx" stuff. Okay, -lc++. Wrong. -lc++abi? Nope. I was getting errors that these libraries could not be found. (Again, WTF?). I threw the general problem out on IRC last night. Another user was kind enough to try to compile the same program. Alas, to no avail. Same issues. For kicks and giggles (or add insult to injury - take your pick), I tried to compile the same code with g++ using dragonegg (-fplugin=dragonegg.so). The error I got back was rather unusual: "undefined reference to `__atomic_fetch_add_4'". This is different. Googling did not help the matter. The llvm.org pages suggests that clang/llvm is "feature complete" with c++11, yet I am unable to compile/link even a simple c++ program using a clang. And the tight coupling between clang/gcc seems a touch disturbing to me. And just to put things over the top - I found the install-clang project on github. It is a script that compiles and installs clang/llvm (either stable or from git master branch) to another directory. Hope?!?! Not... Build would fail at stage 2. Its rather upsetting that trying to do a simple thing as compile a program with c++11 features would cause so much confusion had havoc. This isn't suppose to be this hard! Link to comment Share on other sites More sharing options...
Oleg Vinichenko Posted November 5, 2014 Report Share Posted November 5, 2014 Funtoo has gcc-4.9.2 currently tested, if you want to test enable funtoo-toolchain-overlay on top of tree. Link to comment Share on other sites More sharing options...
digifuzzy Posted November 5, 2014 Author Report Share Posted November 5, 2014 Oleg, I'm still trying to understand how clang/llvm, which is suppose to be seperate and have new capabilities, gets hobbled by gcc revision. Something doesn't add up here. Thanks for the suggestion. I'll give that a try as a workaround for my problems. Link to comment Share on other sites More sharing options...
j-g- Posted November 5, 2014 Report Share Posted November 5, 2014 Did you tried using g++ -std=c++11 ... to compile the program with gcc? Link to comment Share on other sites More sharing options...
digifuzzy Posted November 5, 2014 Author Report Share Posted November 5, 2014 @j-g-: All that and more was tried last night on IRC. And as if this problem doesn't have enough foolishness... gcc was updated but emerge is not cooperating. I have some strange blockage going on. sys-devel/libtool-2.4.3-r2 is blocking the upgrade of dev-libs/libltdl-2.4.3. Indication from web pages is that libltdl is being split out of libtools. Reading the emerge for libltdl, it explicitly calls out libtool latest (depends !< libtool ver ). However, there is no later version available. What a mess... Link to comment Share on other sites More sharing options...
digifuzzy Posted November 5, 2014 Author Report Share Posted November 5, 2014 Right...I'm pretty much at my wits end here... I had upgraded gcc from 4.8.2 to 4.9.1 without problems. I am now running into emerge blocks with updating. What appears to be the problem is with libtool, libltdl and dev-libs/redlands. Result of emerge -auDN below: # emerge -auDN world These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild N ] dev-libs/libltdl-2.4.3 USE="-static-libs" [ebuild U ] dev-libs/redland-1.0.17-r1 [1.0.17] [blocks B ] <sys-devel/libtool-2.4.3-r2:2 ("<sys-devel/libtool-2.4.3-r2:2" is blocking dev-libs/libltdl-2.4.3) * Error: The above package list contains packages which cannot be * installed at the same time on the same system. (sys-devel/libtool-2.4.2-r1::gentoo, installed) pulled in by sys-devel/libtool required by @system >=sys-devel/libtool-2.4.2-r1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] (>=sys-devel/libtool-2.4.2-r1[abi_x86_64(-)]) required by (dev-db/unixODBC-2.3.2::gentoo, installed) >=sys-devel/libtool-2.2.6b required by (media-libs/libcanberra-0.30-r2::gentoo, installed) sys-devel/libtool required by (net-mail/mailutils-2.99.98::gentoo, installed) sys-devel/libtool required by (net-nds/openldap-2.4.40::gentoo, installed) >=sys-devel/libtool-2.4.2 required by (media-sound/pulseaudio-5.0.20141024::gentoo, installed) sys-devel/libtool required by @selected sys-devel/libtool required by (dev-scheme/guile-2.0.11-r1::gentoo, installed) (dev-libs/libltdl-2.4.3::gentoo, ebuild scheduled for merge) pulled in by dev-libs/libltdl required by (dev-libs/redland-1.0.17-r1::gentoo, ebuild scheduled for merge) For more information about Blocked Packages, please refer to the following section of the Gentoo Linux x86 Handbook (architecture is irrelevant): http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#blocked dev-libs/redlands was pulled in, by I believe, by libreoffice. However, I think I have to stop beating my head against the wall. Must...stop...blood....loss... :( Reverting gcc. Link to comment Share on other sites More sharing options...
digifuzzy Posted November 5, 2014 Author Report Share Posted November 5, 2014 Looks like my issues with upgrading are related to gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=528294 Lets hear it for IRC discussions... Link to comment Share on other sites More sharing options...
digifuzzy Posted November 7, 2014 Author Report Share Posted November 7, 2014 As was suggested to me on IRC, wait for a day - try again. Good advice. With the foolishness of gentoo bug #528294 out of the way, I tried again the upgrade of gcc. Amazingly, the gcc upgrade moved along quite well! I then re-emerged my system (~850 ebuilds and 8 hours later) and no hiccups - everything seems to be working well. I then went back to the code mentioned in the OP to compile. The commands, both gcc and clang, were rather simple - as opposed to the convuleted attempts made during IRC discssion. In both cases, it boiled down to [g++|clang++] -std=c++11 main.cpp -o mainYeah! c++11 features! No -stdlib=libc++ or -lc++ or rediculous include statements. Observations - Even though clang installed is the latest/greatest, it was hobbled by gcc version preventing usage of newer c++ standard features. I don't know how else to explain it. llvm.org site indicates that they are moving to c++1y/c++14. So having an up to date gcc(in the 4.9 series or later) would seem to be a must. - When one uses emerge -e worldit does just that. It emerges everything, even the kernel! I had followed the install instructions from the wiki and was surprised to find out that the kernel was recompiled with the latest installed gcc. - The instructions for gcc upgrading from gentoo wiki do work. Attempting to upgrade, downgrade then upgrade again I had no problems. - It was bad timing on my part being bitten by the gentoo bug. But I still have this overwhelming urge to give the dev responsible a good SMACK up side the head for surprising us with such an arbitrary change. I'll get over it....maybe... - And last but not least...I'm glad I moved over to funtoo. The IRC/forums are helpful - unlike other distro's. Yeah funtoo! Link to comment Share on other sites More sharing options...
overkill Posted November 7, 2014 Report Share Posted November 7, 2014 Welcome to Funtoo. I don't know if you are aware of it or not, but gcc is a slotted package. That means that you can have more than one version installed. You can select which of your versions is default by using `gcc-config`. Link to comment Share on other sites More sharing options...
digifuzzy Posted November 7, 2014 Author Report Share Posted November 7, 2014 @overkill - got that. problem was that the gcc install by default was gcc-4.8.2. This lead to all the problems about not having c++11 features and my questions about clang being hobbled by gcc. gcc-config was discussed on the gentoo wiki page for gcc upgrading. Did some reading. Thx Link to comment Share on other sites More sharing options...
Recommended Posts