LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem using GCC output in GNAT (Mingw system) (https://www.linuxquestions.org/questions/linux-newbie-8/problem-using-gcc-output-in-gnat-mingw-system-4175471593/)

DrVonBraun 07-31-2013 07:14 AM

Problem using GCC output in GNAT (Mingw system)
 
Hello,

this is my first post so I hope I'm doing it in the right forum but after checking the Programming forum I thought it's more about general programing questions.

Anyway, I'm new to Linux after programing on Visual Studio for years and I ran into quite some problems most of which I was able to solve but with this one I'm hitting a wall.

I installed Ubuntu13 64 recently and started to set up a development environment. Since I want to use it mostly for Ada I installed the GPS workbench from Ada core which comes with it's own version of the GCC toolset, I believe it is Mingw, at least on Windows it is, not sure if that's true on Linux as well.

Now my main interest is to develop console applications there, so I got the latest version of ncurses and did the usual ./configure make make install sequence and all went fine.

However now, when I make a simple hello world program in the GPS workbench (using the c++ compiler, no mixed language with Ada at all) I am getting this error message:

/usr/lib/libncurses.a: could not read symbols: File format not recognized
collect2: error: ld returned 1 exit status

So I guess that the compiler that comes with Adacore's GPS workbench is somehow not compatible with the standard gcc toolset that comes with Ubuntu?

Thanks for any help


PS I checked the compiler with gcc -v and it reports that it is the GNAT compiler so I guess there is no second toolset installed. I found some posts that pointed me in the direction of the archive manager ar and how to extract a file from it and test it with the file command and it turned out that the ncurses library is in 64 bit format, at least that's what I think, it says "ELF 64-bit, x86-64...". Perhaps that is the problem. But if it was compiled with the GCC that comes with Ada, why is it different when I make this library with make? When I check my test.o file that contains my hello world program it comes out as 32 bit. Is there a way to force the creation of a 32 bit library when I use make?

jpollard 07-31-2013 09:34 AM

Depends on the flags in the Makefile... gcc can create 32 bit or 64 bit code. Usually the compiler flags are listed with the name CFLAGS in the Makefile.

Frequently, the problem is running a 32 bit kernel on a 64 bit capable machine (sometimes picked by accident... to correct it usually requires a reinstallation as there are a LOT of other things that get limited).

It IS possible to run 32 bit binaries on a 64 bit linux (at least on Intel), it is not possible to run 64 bit binaries on a 32 bit linux (no 64 bit kernel calls for instance due to hardware limitations: no 64 bit hardware instructions available/registers..., 64 bit linux CAN support a 32 bit environment).

DrVonBraun 07-31-2013 10:08 PM

Well thanks for the help. I am trying various things and the "best" that happens is a missing or incompatible crt1.o and crti.o linker error.
At this point I think that the 64 bit Linux I have installed is just giving me trouble. Since I am new to this thing and I dont want to have to deal with 32 and 64 bit compatibility issues I think I will install the 32 bit version of ubuntu and of the Gnat compiler system and hope that this solves my problems


All times are GMT -5. The time now is 09:56 AM.