?
Solved

Problems compiling/linking with two GCC versions installed.

Posted on 2008-10-07
6
Medium Priority
?
1,364 Views
Last Modified: 2013-12-06
I've dug myself into a hole.

I have compiled and installed GCC from source, two versions (3.1.4 and 4.3.2). I have used the -prefix=/usr/local/gcc-3.1.4 and -prefix=/usr/local/gcc-4.3.2 for both. I have added a sym link from /usr/local/bin/g++ to /usr/local/gcc-3.4.1/bin/g++.

I am compiling a C++ project using NetBeans. When it compiles, I get the following errors multiple times:

/usr/local/lib/libpqxx.a(connection_base.o): In function `operator<< <std::char_traits<char> >':
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../include/c++/4.3.2/ostream:517: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'

I have no idea why it is referencing the include files in 4.3.2. I don't know exactly how gcc or NetBeans works with all the standard c++ libraries. I'm also using libpq and libpqxx libraries to do DB stuff.


* Fedora Core 8.
* NetBeans 6.1.
* GCC 3.4.1 and 4.3.2.
* GNU Make 3.8.1.

A long time ago (a few weeks ago) before I started fidgeting with gcc, I used to just compile and build c++ code with the gcc compiler that was installed with Fedora, and it worked fine. Somewhere along the line I started using libpqxx code that wasn't compiling correctly, so I update gcc for that.

Then I was able to build and run the code with the newer compiler, but when I ran it I would get the following error:

dimages: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by dimages)

..."dimages" being the name of my program. So I read a few posts that gave me the idea to try to use an older compiler. This is where I am now stuck.


Thanks in advance!
0
Comment
Question by:alexatsearidge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:alexatsearidge
ID: 22662563
OK,

A bit of a change here. I fixed the problem by removing a "-L../../gcc-3.4.1/lib". Cleaning up the linker options seems to have done the trick. Also note that version 3.1.4 should be 3.4.1 (I have the latter, not what I had mentioned above).

After having done that I seemed to get even worse linker errors, however.

`.gnu.linkonce.t._ZNK12cimg_library4CImgIhE10get_resizeEiiiij' referenced in section `.rodata' of build/Debug/GNU-Linux-x86/src/DAWC_ImageManager.o: defined in discarded section `.gnu.linkonce.t._ZNK12cimg_library4CImgIhE10get_resizeEiiiij' of build/Debug/GNU-Linux-x86/src/DAWC_ImageManager.o

Another net search suggested I downgrade binutils. In attempting to do that I was warned of failed dependancies:

        binutils < 2.15.94.0.2-1 conflicts with glibc-devel-2.7-2.i386
        binutils < 2.17.50.0.3-4 conflicts with binutils-devel-2.17.50.0.18-1.i386
        binutils >= 2.17.50.0.17-3 is needed by (installed) gcc-4.1.2-33.i386

So I figure'd I try using the newer gcc again and see how far that gets me. So now I'm stuck using gcc-4.3.2, compiling and linking just fine, but when I run I get:

dimages: /usr/local/gcc-3.4.1/lib/libstdc++.so.6: version `CXXABI_1.3.1' not found (required by dimages)
dimages: /usr/local/gcc-3.4.1/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by dimages)

ANY IDEAS?
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22667569
You need to check the environment variables 'include' and 'lib' which should point to the folders of the appropriate version. Normally, the latest installation will overwrite these settings.
0
 

Author Comment

by:alexatsearidge
ID: 22688176
So...you're saying that if I do the following:

include=/usr/local/gcc-4.3.2/include
lib=/usr/local/gcc-4.3.2/lib
export include
export lib

and then recompile and run, I won't get the errors anymore?

I tried that, it didn't work.
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 2000 total points
ID: 22697534
>>>> tried that, it didn't work.
>>>> I have no idea why it is referencing the include files in 4.3.2.
if you set the environment to 4.3.2, you may not wonder why the compiler establishes a reference ...

Note, the include and lib is only one possibility why it may not work. Check, the makefile and the sources whether none of them explicitly includes or sets definitions for the wrong environment.

Generally, it is not a good idea when building at the command line to have more than one compiler version active beside you have good expertise in both the operation system and the compiler.
0
 

Author Comment

by:alexatsearidge
ID: 22733762
I'll give you the answer since technically you answered my original question. Note that in my follow-up post above I stated that I did indeed get rid of the original error messages by removing a faulty linker option.

I modified my question in the follow-up post to get help on the GLIBCXX errors being thrown after running the application. I have so far been unable to solve this problem.

I have, however, been able to build and use another older version of gcc without getting those errors (version 4.0.0). But I still don't know why I'm getting those errors in 4.3.2, and how I can solve them. I would be interested in finding that solution. But since I've found a way to work around it, I'm closing this question.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22734107
Sorry for not reading your follow-up question thoroughly and thanks for accepting my answer nevertheless ...

>>>> dimages: /usr/local/gcc-3.4.1/lib/libstdc++.so.6: version `CXXABI_1.3.1' not found (required by dimages)

It seems to be a library for screensaver. I found that link

http://www.brothersoft.com/dimages-126905.html

where you could download version 1.3.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question