LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices



Reply
 
Search this Thread
Old 05-26-2012, 10:02 AM   #1
fgcl2k
Member
 
Registered: Jan 2011
Distribution: Slackware 14.1
Posts: 108

Rep: Reputation: 29
Cross compilation fails on Ubuntu 12.04


After upgrading to Ubuntu 12.04, the project I am working on does not (cross) compile/link any more. It works on Ubuntu 11.10, Debian Squeeze, Slackware 13.37 and Centos 5.4. The linker can't find the required libraries.

I get the following message:
Code:
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/.././opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/../../../../i586-hardhat-linux/bin/ld: warning: ld-linux.so.2, needed by /opt/hardhat/devkit/x86/586/lib/gcc-lib/../../target/lib/libc.so.6, not found (try using -rpath or -rpath-link)
I have the same settings (environment, PATH, etc) in all distributions I have tested. I have tested both Ubuntu releases booting from the live CD and mounting the same hard disk in order to be sure I didn't change some settings.

Here is part of the output with the options CXXFLAGS="-Wl,-verbose"

On Ubuntu 11.10:
Code:
attempt to open libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/../../../../i586-hardhat-linux/lib/libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/../../../../i586-hardhat-linux/lib/libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/../../target/lib/libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/../../target/usr/lib/libc_nonshared.a succeeded
...
ld-linux.so.2 needed by /opt/hardhat/devkit/x86/586/lib/gcc-lib/../../target/lib/libc.so.6
found ld-linux.so.2 at /mnt/sda6/opt/hardhat/devkit/x86/586/target/lib/ld-linux.so.2
On Ubuntu 12.04, ld-linux.so.2 is not found:
Code:
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/libc_nonshared.a failed
attempt to open /opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/.././opt/hardhat/devkit/x86/586/lib/gcc-lib/i586-hardhat-linux/3.2.1/../../../../i586-hardhat-linux/bin/ld: warning: ld-linux.so.2, needed by /opt/hardhat/devkit/x86/586/lib/gcc-lib/../../target/lib/libc.so.6, not found (try using -rpath or -rpath-link)
/opt/hardhat/devkit/x86/586/lib/gcc-lib/../../target/lib/libc.so.6: undefined reference to `_dl_lazy@GLIBC_2.1.1'
/opt/hardhat/devkit/x86/586/lib/gcc-lib/../../target/lib/libc.so.6: undefined reference to `_dl_dst_substitute@GLIBC_2.1.1'
...
It looks like in Ubuntu 12.04 different paths are searched for the libraries
than Ubuntu 11.10, Debian, Slackware and Centos.

Thanks in advance for your help.
 
Old 05-26-2012, 03:32 PM   #2
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,151

Rep: Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364
you can see if there was a similar lib: ld-linux* and you may create a link. Or probably it is a configuration problem
 
Old 05-26-2012, 04:25 PM   #3
fgcl2k
Member
 
Registered: Jan 2011
Distribution: Slackware 14.1
Posts: 108

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by pan64 View Post
you can see if there was a similar lib: ld-linux* and you may create a link. Or probably it is a configuration problem
I think it is probably a configuration problem, but can't understand what it is. The tools are for cross compilation and they should be able to find their own libraries, which happens on every system except Ubuntu 12.04.
A symbolic link can solve the problem but it is a hack, because I need to create a link for every library used.
On Ubuntu 11.10 the (target) linux loader was found:
Code:
found ld-linux.so.2 at /mnt/sda6/opt/hardhat/devkit/x86/586/target/lib/ld-linux.so.2
 
Old 06-04-2012, 11:21 AM   #4
eech
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Rep: Reputation: Disabled
I'm running into the same problem. Where you able to solve this?

In which place did you create the link for the work around?

Thanks in advance for your help.
 
Old 06-06-2012, 03:20 PM   #5
fgcl2k
Member
 
Registered: Jan 2011
Distribution: Slackware 14.1
Posts: 108

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by eech View Post
I'm running into the same problem. Where you able to solve this?
No, I wasn't.
Quote:
Originally Posted by eech View Post
In which place did you create the link for the work around?
To create the link I run the compiler with the flags
Code:
CFLAGS="-Wl,-verbose"
CXXFLAGS="-Wl,-verbose"
This shows where the linker is looking for the libraries. Next I created a symbolic link from the place where the linker is looking for the file to the real file.
I am not at the office now so I can't show you an example until tomorrow.
 
Old 06-11-2012, 09:43 AM   #6
eech
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Rep: Reputation: Disabled
I changes the specs file to include the directory for the linker, which worked for me. This way I do not have to change any project files.

Here is a diff of my specs file:

Index: /cross/hardhat/devkit/mips/fp_be/lib/gcc-lib/mips-hardhat-linux/3.2.1/specs

@@ -42,7 +42,7 @@
%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s

*link:
-%{!static:--eh-frame-hdr} %(endian_spec) %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} %{static:-static}}}
+%{!static:--eh-frame-hdr} %(endian_spec) %{shared:-shared} %{!-rpath-link*:-rpath-link /cross/hardhat/devkit/mips/fp_be/target/lib/} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} %{static:-static}}}

*lib:
%{shared: -lc} %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} %{profile:-lc_p} %{!profile: -lc}}
 
1 members found this post helpful.
Old 06-14-2012, 03:57 AM   #7
fgcl2k
Member
 
Registered: Jan 2011
Distribution: Slackware 14.1
Posts: 108

Original Poster
Rep: Reputation: 29
Great work, thank you!!! That worked for me too.
I am still left wondering why this isn't necessary with all the other Linux installations that I have tested...
 
Old 06-14-2012, 04:36 AM   #8
eech
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Rep: Reputation: Disabled
I also still do not understand what is causing it to no longer work on 12.04. Maybe it has something to do with the changes in the lib32 environment, however I'm happy to once again use my unsupported dev environment
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] cross compilation joslyn Linux - Newbie 3 04-23-2010 03:33 AM
cross compilation shariefbe Linux - Software 5 02-15-2010 06:23 AM
cross compilation shaiva Linux - Newbie 2 10-06-2009 04:43 AM
all about cross compilation swift2008 Programming 3 08-27-2008 06:49 AM
cross compilation NeoMagic Programming 5 12-13-2006 03:19 AM


All times are GMT -5. The time now is 01:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration