Using GnatPro25.2 on Windows 11.
I am attempting what should be a simple compilation. I have 4 withs in my coontrolling GPR file
With winada32
With LibAdaLang
With SharedLibrary1.gpr
With SharedLibrary2.gpr.
Without the shared Libraries the project links without issue as the linker implicitly sets -static-libgcc.
With the shared library projects the linker implicitly sets -shared-libgcc.
This causes LD to fail when attempting to link libgnat.a because it cannot resolve any of the windows socket library symbols (undefined reference to every single symbol!)
I cannot get the linker via any of the ‘switches’ to recognise or accept -allow-shlib-undefined.nor can I get it to accept nor link libws2-32.a (note all of the windows/gnat libraries are in C:Gnatpro\25.2\lib\gcc\x86_64-w64-mingw32\13.3.1 which is the default LD_LIBRARY_PATH set up when you install GnatPro)
Given this is the linker failing to resolve the gnat library symbol references
Any help would be appreciated ..
The Windows socket library is ws2_32.dll. The linker switch is “-lws2_32” I guess you are mixing static and dynamic linking.
It is impossible to say without seeing the gpr-files and scenario variables.
Use GNAT.Sockets instead of direct Windows socket calls. It is portable and safe.
Given its libgnat.a a that is failing to resolve its own symbols, and libgnat.a is ADACORE, and its the linker default script which is determining the linking strategy (auto setting dynamic because of the presence of the shared library gprs ) there is nothing I can do to change this.
The contents of the shared library gprs here is not specifically relevant, it doesn’t build them, they are prebuilt. It needs the gpr so that it doesn’t build them but can resolve the methods contained within the libraries which are pure ADA.
What I need is some mechanism to force the linker to obey its own command line arguments which is what –allow-shlib-undefined should do, at least according to ADACore’s own reference manual for the linker.
Quite relevant. For example, prebuilt library projects must have:
for Externally_Built use "true";
What you need is to understand what is going on. It is completely determined by the gpr-files.