Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to fix crt1.o: No such file or directory (link error for gnat)? after installing gnat 2012 on linux

3,149 views
Skip to first unread message

Nasser M. Abbasi

unread,
Jun 26, 2012, 1:47:58 PM6/26/12
to
I've see this error before, and I googled it. But the
solutions I found not helping.

Does any one know how to make gnat see crt1.o?

I installed gnat 2012 ok. Followed all the questions,
and all went well. It installed to /usr/gnat.
I am on linux.

Now when I try to compile a file, I get this error:

------------------------------
>gnatmake t44.adb
gnatbind -x t44.ali
gnatlink t44.ali
/usr/gnat/libexec/gcc/i686-pc-linux-gnu/4.5.4/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.
--------------------------

locate shows this

----------------------------
>locate crt1.o
/usr/lib/i386-linux-gnu/Mcrt1.o
/usr/lib/i386-linux-gnu/Scrt1.o
/usr/lib/i386-linux-gnu/crt1.o
/usr/lib/i386-linux-gnu/gcrt1.o
--------------------------

and

-----------------------------
>sudo apt-get install libc6-dev
[sudo] password for me:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dev is already the newest version
---------------------------------

and

---------------------------
>which gnatmake
/usr/gnat/bin/gnatmake
>gnatmake -v

GNATMAKE GPL 2012 (20120509)
----------------------------------

and
--------------
>echo $PATH
/usr/gnat/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
---------------

SO, I think I just need to tell it to use the crt1.o
in /usr/lib/i386-linux-gnu/crt1.o, right?

I forgot how to do that. Do I need to run some Linux
command or something? the gnat README did not say
another, other that to run the doinstall script, which
I did ofcourse.

thank you,
--Nasser

Nasser M. Abbasi

unread,
Jun 26, 2012, 2:08:55 PM6/26/12
to
solved it!

here it is, in case someone else hits this problem:

>export LIBRARY_PATH=/usr/lib/i386-linux-gnu/

>gnatmake -gnat2012 t44.adb
gcc -c -gnat2012 t44.adb
gnatbind -x t44.ali
gnatlink t44.ali

I do not know why it happens, but the above will fix it.

--Nasser

Brian Drummond

unread,
Jun 26, 2012, 7:17:12 PM6/26/12
to
On Tue, 26 Jun 2012 13:08:55 -0500, Nasser M. Abbasi wrote:

> solved it!
>
> here it is, in case someone else hits this problem:
>
>>export LIBRARY_PATH=/usr/lib/i386-linux-gnu/
...
>
> I do not know why it happens, but the above will fix it.

The basic problem is that some Linux distributions (Debian,Ubuntu)
support multilib (libs for various target machines, e.g. cross-compiling
for Arm, AVR or even Windows, or even just 32 and 64 bit x86), and some
tool chains don't.

If you are using Debian or Ubuntu, but installing another Gnat, this is
possible.
export LIBRARY_PATH seems to be the easiest fix. Or install Debian's own
Gnat package, as appropriate.

- Brian

Georg Bauhaus

unread,
Jun 27, 2012, 3:16:12 PM6/27/12
to
"Nasser M. Abbasi" <n...@12000.org> wrote:
> solved it!
>
> here it is, in case someone else hits this problem:
>
>> export LIBRARY_PATH=/usr/lib/i386-linux-gnu/

> I do not know why it happens, but the above will fix it.

The issue seems to be an early disagreement between the
developers of Debian an Ubuntu on the one side and
GCC on the other side on hoe to handle multi arch support.

giorgio....@gmail.com

unread,
Nov 20, 2012, 2:48:31 PM11/20/12
to

>
> >> export LIBRARY_PATH=/usr/lib/i386-linux-gnu/
>

attention depends of your system because depends from where is the file crt1.o

I recommend:

$ locate crt1.o
...
/usr/lib/debug/usr/lib32/ ...
/usr/lib/x86_64-linux-gnu/Mcrt1.o
/usr/lib/x86_64-linux-gnu/Scrt1.o

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

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

required to locate the path of the file and then
the correct invocation of export is:

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


clarag...@gmail.com

unread,
Mar 17, 2013, 3:17:09 PM3/17/13
to n...@12000.org

Thank you Nasser. This solved the problem I had using mac 10.7.4 and GNAT. Thank you!
0 new messages