Kevin Brown writes:
[Trouble linking statically]

> For what it's worth, here's one iteration of the linker package
> definition that I've tried to use:
>
>    package Linker is
>       for Default_Switches ("Ada") use
>         ("-g",
>          "-static",
>          "/usr/lib/libgnatprj.a",
>          "/usr/lib/libgnatvsn.a",
>          "/usr/lib/libtemplates_parser.a",
>          "/usr/lib/libgtkada2.a",
>          "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/adalib/libgnarl.a",
>          "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/adalib/libgnat.a",
>          GtkAda2.Linker_Switches,
>          Gnatprj.Linker_Switches,
>          Gnatvsn.Linker_Switches,
>          Templates_Parser.Linker_Switches,
>          --  Some C libraries which we build from debian/rules:
>          "obj/libgps.a", "obj/libdb.a",
>          --  The python shared library from python-dev comes
>          --  last, because libgps.a needs it.
>          "-L/usr/lib/python2.4/config",
>          "-lpython2.4");
>    end Linker;

The problems are:

- You must pass -static to the *binder*, not the *linker*.  As per the
  GAT documentation, you do not need to pass libgnata or libgnarl.a
  explicitly; the binder's job is to figure out these things for you.

- Like I said, you should be linking statically with all Ada
  libraries.  Consequently, you should have removed the
  *.Linker_Switches, since they're the ones bringing in the shared
  libraries.

- libgps.a is not an Ada library, and it does not require any shared
  library, so it is not the cause for your problem.  Same with
  libdb.a.

Here is a correct project file snippet:


   package Binder is
      for Default_Switches ("Ada") use ("-static");
   end Binder;

   package Linker is
      for Default_Switches ("Ada") use
        ("/usr/lib/libgnatprj.a",
         "/usr/lib/libgnatvsn.a",
         "/usr/lib/libtemplates_parser.a",
         "/usr/lib/libgtkada2.a",
         "-lgtk-x11-2.0",
         --  Some C libraries which we build from debian/rules:
         "obj/libgps.a", "obj/libdb.a",
         --  The python shared library from python-dev comes
         --  last, because libgps.a needs it.
         "-lpython2.4");
   end Linker;

And the output of ldd for the resulting gnat-gps:

$ ldd gnat-gps
        libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x00002ae6438ae000)
        libpython2.4.so.1.0 => /usr/lib/libpython2.4.so.1.0 (0x00002ae643cd7000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00002ae643f16000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00002ae64402b000)
        libc.so.6 => /lib/libc.so.6 (0x00002ae644138000)
        libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 
(0x00002ae644376000)
        libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x00002ae64448e000)
        libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x00002ae644622000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00002ae644764000)
        libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00002ae64496d000)
        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00002ae644aae000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00002ae644bb2000)
        libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 
(0x00002ae644d4f000)
        libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x00002ae644e58000)
        libdl.so.2 => /lib/libdl.so.2 (0x00002ae644f79000)
        libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00002ae64507c000)
        libm.so.6 => /lib/libm.so.6 (0x00002ae6451e5000)
        libutil.so.1 => /lib/libutil.so.1 (0x00002ae645368000)
        /lib64/ld-linux-x86-64.so.2 (0x00002ae643796000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00002ae64546b000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x00002ae64559e000)
        libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00002ae6456b0000)
        libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00002ae6457b9000)
        libXi.so.6 => /usr/lib/libXi.so.6 (0x00002ae6458bb000)
        libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00002ae6459c4000)
        libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00002ae645ac7000)
        libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00002ae645bd1000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x00002ae645cd7000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00002ae645dd9000)
        librt.so.1 => /lib/librt.so.1 (0x00002ae645ede000)
        libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 
(0x00002ae645fe8000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00002ae646116000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00002ae64628e000)
        libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00002ae6463a5000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00002ae6464c8000)

-- 
Ludovic Brenta.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to