comp.lang.ada
 help / color / mirror / Atom feed
* Linking problem in GPS 2011
@ 2011-10-21 19:41 Hans Petter Ladim
  2011-10-21 20:35 ` Ludovic Brenta
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Petter Ladim @ 2011-10-21 19:41 UTC (permalink / raw)


Hello,
I want to use GPS 2011 GPL edition from Adacore on my Linux Mint based
on debian.
I have installed GPS with the doinstall command using the default
install settings all the way.
I have also installed libc6-dev with apt-get install libc6-dev.
The problem is that the project in GPS will not link.
The error from the GPS output is:

gnatmake -d -P/home/hp/gpsproject/pwm/pwm.gpr
gnatbind -I- -x /home/hp/gpsproject/pwm/test_pwm.ali
gnatlink /home/hp/gpsproject/pwm/test_pwm.ali -o /home/hp/gpsproject/
pwm/test_pwm
/usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/ld: crt1.o: No such
file: No such file or directory
collect2: ld returned 1 exit status
gnatlink: error when calling /usr/gnat/bin/gcc
gnatmake: *** link failed.

The  command: readlink -f ld gives /home/hp/ld.
But I also find (as given i the error above) ld in /usr/gnat/libexec/
gcc/x86_64-pc-linux-gnu/4.5.3/ld

I am new toboth Ada and Linux so this may be a very simple problem!
I hope my information about the problem was suffcient.

Thanks in advance!

HP



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-21 19:41 Linking problem in GPS 2011 Hans Petter Ladim
@ 2011-10-21 20:35 ` Ludovic Brenta
  2011-10-22 10:52   ` Hans Petter Ladim
  2011-10-22 10:57   ` Pascal Obry
  0 siblings, 2 replies; 11+ messages in thread
From: Ludovic Brenta @ 2011-10-21 20:35 UTC (permalink / raw)


Hans Petter Ladim writes on comp.lang.ada:
> Hello,
> I want to use GPS 2011 GPL edition from Adacore on my Linux Mint based
> on debian.
> I have installed GPS with the doinstall command using the default
> install settings all the way.
> I have also installed libc6-dev with apt-get install libc6-dev.
> The problem is that the project in GPS will not link.
> The error from the GPS output is:
>
> gnatmake -d -P/home/hp/gpsproject/pwm/pwm.gpr
> gnatbind -I- -x /home/hp/gpsproject/pwm/test_pwm.ali
> gnatlink /home/hp/gpsproject/pwm/test_pwm.ali -o /home/hp/gpsproject/
> pwm/test_pwm
> /usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/ld: crt1.o: No such
> file: No such file or directory
> collect2: ld returned 1 exit status
> gnatlink: error when calling /usr/gnat/bin/gcc
> gnatmake: *** link failed.
>
> The  command: readlink -f ld gives /home/hp/ld.
> But I also find (as given i the error above) ld in /usr/gnat/libexec/
> gcc/x86_64-pc-linux-gnu/4.5.3/ld
>
> I am new toboth Ada and Linux so this may be a very simple problem!
> I hope my information about the problem was suffcient.

Yes, your report is very detailed and I commend you for the precise
description of your problem.

From what you say, it seems that crt1.o is either absent or not where
GNAT GPL's ld looks for it.  Could you try:

$ dpkg -L libc6-dev | grep /crt1.o

$ /usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/ld --verbose \
 | grep SEARCH_DIR | tr ' ' '\n'

On my Debian system (where GNAT GPL Edition is not installed; I use
/usr/bin/ld instead), this yields

/usr/lib/x86_64-linux-gnu/crt1.o

SEARCH_DIR("/usr/x86_64-linux-gnu/lib64");
SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu");
SEARCH_DIR("=/usr/local/lib64");
SEARCH_DIR("=/lib/x86_64-linux-gnu");
SEARCH_DIR("=/lib64");
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu");
SEARCH_DIR("=/usr/lib64");
SEARCH_DIR("=/usr/local/lib");
SEARCH_DIR("=/lib");
SEARCH_DIR("=/usr/lib");

As you can see, on my system crt1.o is in one of the directories of the
SEARCH_DIR of ld.  This is a multiarch-aware directory, not just
/usr/lib; the transition to multiarch started in August this year and
unfortunately breaks older toolchains as explained here:

http://bugs.debian.org/637232

I suspect that your Linux Mint is recent (August 2011 or later) and that
the ld that comes with GNAT GPL Edition is not multiarch-aware and
therefore looks in /usr/lib and not in /usr/lib/x86_64-linux-gnu.

One solution is to

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

before you call gnatmake from GPS.

Another solution is to simply use the Debian packages for Ada
development, which are all multiarch-aware:

aptitude install gnat gnat-gps

Hope this helps

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-21 20:35 ` Ludovic Brenta
@ 2011-10-22 10:52   ` Hans Petter Ladim
  2011-10-22 11:05     ` Pascal Obry
  2011-10-22 12:57     ` Ludovic Brenta
  2011-10-22 10:57   ` Pascal Obry
  1 sibling, 2 replies; 11+ messages in thread
From: Hans Petter Ladim @ 2011-10-22 10:52 UTC (permalink / raw)


Thanks for quick answer!

The command:
$ dpkg -L libc6-dev | grep /crt1.o
Gives:
/usr/lib/x86_64-linux-gnu/crt1.o

The command:
 $ /usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/ld --verbose | grep
SEARCH_DIR | tr ' ' '\n'
Gives:
SEARCH_DIR("/usr/gnat/x86_64-pc-linux-gnu/lib64");
SEARCH_DIR("/usr/gnat/lib64");
SEARCH_DIR("/usr/local/lib64");
SEARCH_DIR("/lib64");
SEARCH_DIR("/usr/lib64");
SEARCH_DIR("/usr/gnat/x86_64-pc-linux-gnu/lib");
SEARCH_DIR("/usr/gnat/lib");
SEARCH_DIR("/usr/local/lib");
SEARCH_DIR("/lib");
SEARCH_DIR("/usr/lib");

And command export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu does not
help. Still same error message.

I belive the version of GPS you get from installing through apt-get is
somewhat old?

I hope to fix this problem using GPS 2011.

Any more ideas? :)

HP



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-21 20:35 ` Ludovic Brenta
  2011-10-22 10:52   ` Hans Petter Ladim
@ 2011-10-22 10:57   ` Pascal Obry
  2011-10-24 10:47     ` Alex R.  Mosteo
  1 sibling, 1 reply; 11+ messages in thread
From: Pascal Obry @ 2011-10-22 10:57 UTC (permalink / raw)
  To: Ludovic Brenta


Ludovic,

> One solution is to
>
> export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

Shouldn't this be LIBRARY_PATH instead of LD_LIBRARY_PATH?

> before you call gnatmake from GPS.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-22 10:52   ` Hans Petter Ladim
@ 2011-10-22 11:05     ` Pascal Obry
  2011-10-22 12:57     ` Ludovic Brenta
  1 sibling, 0 replies; 11+ messages in thread
From: Pascal Obry @ 2011-10-22 11:05 UTC (permalink / raw)
  To: Hans Petter Ladim

Hans,

> And command export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu does not
> help. Still same error message.

Try with:

    $ export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-22 10:52   ` Hans Petter Ladim
  2011-10-22 11:05     ` Pascal Obry
@ 2011-10-22 12:57     ` Ludovic Brenta
  2011-10-22 13:22       ` Simon Wright
  2011-10-22 13:31       ` Pascal Obry
  1 sibling, 2 replies; 11+ messages in thread
From: Ludovic Brenta @ 2011-10-22 12:57 UTC (permalink / raw)


Hans Petter Ladim writes:
> Thanks for quick answer!
>
> The command:
> $ dpkg -L libc6-dev | grep /crt1.o
> Gives:
> /usr/lib/x86_64-linux-gnu/crt1.o
>
> The command:
>  $ /usr/gnat/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/ld --verbose | grep
> SEARCH_DIR | tr ' ' '\n'
> Gives:
> SEARCH_DIR("/usr/gnat/x86_64-pc-linux-gnu/lib64");
> SEARCH_DIR("/usr/gnat/lib64");
> SEARCH_DIR("/usr/local/lib64");
> SEARCH_DIR("/lib64");
> SEARCH_DIR("/usr/lib64");
> SEARCH_DIR("/usr/gnat/x86_64-pc-linux-gnu/lib");
> SEARCH_DIR("/usr/gnat/lib");
> SEARCH_DIR("/usr/local/lib");
> SEARCH_DIR("/lib");
> SEARCH_DIR("/usr/lib");

OK, that confirms my suspicions.

> And command export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu does not
> help. Still same error message.

ld will not see the LD_LIBRARY_PATH unless you start it from the same
shell where you did the export, i.e. try to launch a terminal and say:

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
gnatmake -d -P/home/hp/gpsproject/pwm/pwm.gpr
gps

in the same terminal window.

Is that what you did?

> I belive the version of GPS you get from installing through apt-get is
> somewhat old?

I don't know what version your distribution contains but the latest in
Debian testing are gnat-4.4 4.4.6-5 and gnat-gps 4.3-6.  Note that GPS
is only the integrated development environment; the compiler is gnat.

What do you prefer: a "somewhat old" compiler that works, or a "somewhat
new" compiler that doesn't work?  Is there any particular feature of the
"somewhat new" tools that is absent from the Debian packages and that
you need?

> I hope to fix this problem using GPS 2011.
>
> Any more ideas? :)

* Check that ld sees the LD_LIBRARY_PATH environment variable as I
  explained above.  If this works then you can make the solution
  permanent by adding this to your ~/.xsessionrc:

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

This change will take effect after you log out and log back in.

* If that still fails, log in as root and say:

ln -s /usr/lib/x86_64-linux-gnu/*.o /usr/lib

but this is only a temporary hack, not a proper solution.

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-22 12:57     ` Ludovic Brenta
@ 2011-10-22 13:22       ` Simon Wright
  2011-10-22 13:32         ` Pascal Obry
  2011-10-22 13:31       ` Pascal Obry
  1 sibling, 1 reply; 11+ messages in thread
From: Simon Wright @ 2011-10-22 13:22 UTC (permalink / raw)


I thought LD_LIBRARY_PATH was only for finding shared libraries?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-22 12:57     ` Ludovic Brenta
  2011-10-22 13:22       ` Simon Wright
@ 2011-10-22 13:31       ` Pascal Obry
  1 sibling, 0 replies; 11+ messages in thread
From: Pascal Obry @ 2011-10-22 13:31 UTC (permalink / raw)
  To: Ludovic Brenta


Ludovic,

> * If that still fails, log in as root and say:
>
> ln -s /usr/lib/x86_64-linux-gnu/*.o /usr/lib
>
> but this is only a temporary hack, not a proper solution.

*NO*, don't do that it will mess the system. Use LIBRARY_PATH, should be 
working.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-22 13:22       ` Simon Wright
@ 2011-10-22 13:32         ` Pascal Obry
  0 siblings, 0 replies; 11+ messages in thread
From: Pascal Obry @ 2011-10-22 13:32 UTC (permalink / raw)
  To: Simon Wright


Simon,

> I thought LD_LIBRARY_PATH was only for finding shared libraries?

Not sure my messages went to c.l.a! As I said already many time use 
LIBRARY_PATH and NOT LD_LIBRARY_PATH.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-22 10:57   ` Pascal Obry
@ 2011-10-24 10:47     ` Alex R.  Mosteo
  2011-10-31 20:50       ` Hans Petter Ladim
  0 siblings, 1 reply; 11+ messages in thread
From: Alex R.  Mosteo @ 2011-10-24 10:47 UTC (permalink / raw)


Pascal Obry wrote:

> 
> Ludovic,
> 
>> One solution is to
>>
>> export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
> 
> Shouldn't this be LIBRARY_PATH instead of LD_LIBRARY_PATH?

Seconded, I ran into the same problem some months ago when the 2011 version 
came out.

LIBRARY_PATH is needed at linking time. LD_LIBRARY_PATH is needed to find 
shared libraries at execution time.

Finally, if your projects have C/C++ sources too, you'll likely need to fix 
your C_INCLUDE_PATH too, or basic C headers won't be found either.

From my Ada env setup file:

--8<--
# Fix paths for multiarch, broken since 2011 version
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/include/i386-linux-gnu
export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/i386-linux-gnu
--8<--

(And I haven't had to fix LD_LIBRARY_PATH yet... ?)

> 
>> before you call gnatmake from GPS.
> 
> Pascal.
> 




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Linking problem in GPS 2011
  2011-10-24 10:47     ` Alex R.  Mosteo
@ 2011-10-31 20:50       ` Hans Petter Ladim
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Petter Ladim @ 2011-10-31 20:50 UTC (permalink / raw)


Thank you all for useful answers!

I added the following in the gps script file:

export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

Maybe not the proper way to do it, but it works like a charm!

HP



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-10-31 20:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-21 19:41 Linking problem in GPS 2011 Hans Petter Ladim
2011-10-21 20:35 ` Ludovic Brenta
2011-10-22 10:52   ` Hans Petter Ladim
2011-10-22 11:05     ` Pascal Obry
2011-10-22 12:57     ` Ludovic Brenta
2011-10-22 13:22       ` Simon Wright
2011-10-22 13:32         ` Pascal Obry
2011-10-22 13:31       ` Pascal Obry
2011-10-22 10:57   ` Pascal Obry
2011-10-24 10:47     ` Alex R.  Mosteo
2011-10-31 20:50       ` Hans Petter Ladim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox