Re: Strange link error

Mathieu Dubois <[email protected]> Wed, 13 Jun 2012 12:30:36 +0200
Newsgroups gmane.comp.gcc.gnat
Message-ID <[email protected]>
Hi,

I think I have found the problem. Thanls to the -v switch of gnatmake I 
realized that in the old directory apq.ali was found in the object 
directory of the project while it was not on the new directory (where 
the message was 'apq.ali is a read only library'). I think that the old 
directory contained a copy of apq.ali from the time it was installed on 
my local ADA_*_PATH...

Removing the file caused both project to fail at the same point.

I added the -lapq flag to the linker switch and it works now.

Mathieu

On 06/13/2012 11:41 AM, Mathieu Dubois wrote:
> Hello,
>
> I use gnatmake and a GPR file to build a project and I recently faced 
> an error that I don't understand.
> The problem arose when we moved some stuff in our SVN repository but I 
> would be really surprised that this caused the problem.
>
> The situation is as follow. The GPR project is located in a 
> subdirectory (say foo/my_project/my_project.gpr). It uses other 
> projects which are given by their relative path in with clauses. The 
> project uses the APQ 2.1 library which is installed in GCC path 
> (apq.ads is in 
> /usr/lib/gcc/x86_64-linux-gnu/4.6/rts-native/adainclude/, apq.ali is 
> in /usr/lib/gcc/x86_64-linux-gnu/4.6/rts-native/adalib/apq.ali).
>
> Due to the modifications on the repository I have indeed two copies of 
> my_project: let's say that the current working is under foo/ and I 
> have a unversionned copy under foo_tmp.
>
> Under foo_tmp/my_project everything works fine (gnatmake -P 
> my_project.gpr works nicely).
> Under foo/my_project the same command leads to a link error:
> gnatlink 
> /home/duboism/Documents/These/Code/manips/rvg/manips/DB_Handler/objs/test_requestimage.ali 
> -shared-libgcc -g -o 
> /home/duboism/Documents/These/Code/manips/rvg/manips/DB_Handler/test_requestimage
> /usr/lib/gcc/x86_64-linux-gnu/4.6/adalib//libapq.a(apq-postgresql-client.o): 
> In function `apq__postgresql__client__host_name':
> apq-postgresql-client.adb:(.text+0x6d0): undefined reference to `PQhost'
> ...
>
> I can't figure out what's going on.
> As far as I can tell the commands are the same (I watched the logs the 
> only diffence is foo_tmp being replace by foo).
> The GPR files are the same and the relative path too.
> I use gnatclean -r -P my_project.gpr before using gnatmake...
>
> Any idea?
>
> Thanks in advance,
> Mathieu
>
> _______________________________________________
> help-gnat mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-gnat