comp.lang.ada
 help / color / mirror / Atom feed
* Shered library in Ada - undefined symbols problem (Ubuntu)
@ 2013-07-08 11:43 Maciej Sobczak
  2013-07-08 11:54 ` Maciej Sobczak
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej Sobczak @ 2013-07-08 11:43 UTC (permalink / raw)


Hi,

While trying to run the older program that was based on shared library written in Ada I have found that my library has some undefined symbols, namely:

interfaces__c_E

This symbol is defined in the libgnat.a library, but it is not linked in to my own shared library file. When the shared library is loaded with dlopen, the error message points to the above symbol as missing.

I have tried to force static linking of my shared library (to bring all dependent symbols into a single file), but the linker refused complaining about relocation issues - apparently the static version of the GNAT runtime library is not itself compiled with fPIC.

Any tips on how to move forward?

This is Linux Ubuntu, GNAT 4.6 from official packages.

-- 
Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com

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

* Re: Shered library in Ada - undefined symbols problem (Ubuntu)
  2013-07-08 11:43 Shered library in Ada - undefined symbols problem (Ubuntu) Maciej Sobczak
@ 2013-07-08 11:54 ` Maciej Sobczak
  2013-07-08 16:22   ` Simon Wright
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej Sobczak @ 2013-07-08 11:54 UTC (permalink / raw)



> This is Linux Ubuntu, GNAT 4.6 from official packages.

Interesting additional info: it works like a charm with GNAT GPL 2013 on the same system.

Does it qualify as a bug in the FSF version of GNAT?

Just in case you would like to reproduce it, the minimal test is described here:

http://www.inspirel.com/articles/Ada_Python_Binding.html

The code snippets are complete - it is enough to save them as files with appropriate names. The Python's ctypes.CDLL(...) presented in the example Python session is the critical line.

-- 
Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com


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

* Re: Shered library in Ada - undefined symbols problem (Ubuntu)
  2013-07-08 11:54 ` Maciej Sobczak
@ 2013-07-08 16:22   ` Simon Wright
  2013-07-09  7:41     ` Maciej Sobczak
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Wright @ 2013-07-08 16:22 UTC (permalink / raw)


Maciej Sobczak <see.my.homepage@gmail.com> writes:

>> This is Linux Ubuntu, GNAT 4.6 from official packages.
>
> Interesting additional info: it works like a charm with GNAT GPL 2013
> on the same system.
>
> Does it qualify as a bug in the FSF version of GNAT?

No problem with FSF GCC 4.6.0 on Mac OS X.

I tried

   for Library_Auto_Init use "true";

and removing the calls to ada_moduleinit() and ada_modulefinal(), which
gave a segv on 4.6 but was fine on 4.8.1.

In both cases I used gprbuild, because of gnatmake's inability to deal
with .dylibs & rpath properly.

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

* Re: Shered library in Ada - undefined symbols problem (Ubuntu)
  2013-07-08 16:22   ` Simon Wright
@ 2013-07-09  7:41     ` Maciej Sobczak
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej Sobczak @ 2013-07-09  7:41 UTC (permalink / raw)



> No problem with FSF GCC 4.6.0 on Mac OS X.

Thank you for checking.

> I tried
> 
>    for Library_Auto_Init use "true";
> 
> and removing the calls to ada_moduleinit() and ada_modulefinal(), which
> gave a segv on 4.6 but was fine on 4.8.1.

Which is a huge pity, as this difference will impact the portability of projects (the program will crash on one version or the other). Moreover, now I'm not even sure what is the intended/recommended strategy with regard to these calls.

> In both cases I used gprbuild, because of gnatmake's inability to deal
> with .dylibs & rpath properly.

Which brings the question: why not fix gnatmake in the first place?

-- 
Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com

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

end of thread, other threads:[~2013-07-09  7:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-08 11:43 Shered library in Ada - undefined symbols problem (Ubuntu) Maciej Sobczak
2013-07-08 11:54 ` Maciej Sobczak
2013-07-08 16:22   ` Simon Wright
2013-07-09  7:41     ` Maciej Sobczak

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