|
|
||||
|
||||
|
|
|
|||
|
On Wed, 22 Feb 2012 07:31:29 -0800 (PST), tonyg wrote:
> Whenever I compile some code for a different PC , it asks me for the > runtime libraries for gtk and some others. Is there a way I can link > my executable so the functions used in these libraries are included in > my executable ? You have to link to the static (object) libraries. Whether this would work depends on whether the provider of the library allows static linkage or not. The answer would depend on the target platform and the licensing policy. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de |
|
|||
|
On Feb 22, 4:01*pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote: > On Wed, 22 Feb 2012 07:31:29 -0800 (PST), tonyg wrote: > > Whenever I compile some code for a different PC , it asks me for the > > runtime libraries for gtk and some others. Is there a way I can link > > my executable so the functions used in these libraries are included in > > my executable ? > > You have to link to the static (object) libraries. Whether this would work > depends on whether the provider of the library allows static linkage or > not. The answer would depend on the target platform and the licensing > policy. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de The librarys are all debian based, things like libgnadecommon and libgtk, I was really looking for the command to give to gnatmake, I know - static option links in the gnat runtime etc |
|
|||
|
On 2012-02-22, tonyg <tonythegair@gmail.com> wrote:
> On Feb 22, 4:01Â*pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> > wrote: >> On Wed, 22 Feb 2012 07:31:29 -0800 (PST), tonyg wrote: >> > Whenever I compile some code for a different PC , it asks me for the >> > runtime libraries for gtk and some others. Is there a way I can link >> > my executable so the functions used in these libraries are included in >> > my executable ? >> >> You have to link to the static (object) libraries. Whether this would work >> depends on whether the provider of the library allows static linkage or >> not. The answer would depend on the target platform and the licensing >> policy. >> >> -- >> Regards, >> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de > > The librarys are all debian based, things like libgnadecommon and > libgtk, > I was really looking for the command to give to gnatmake, I know - > static option links > in the gnat runtime etc If I understand you correctly you have two options: 1. Instead of -lfoo specify /full/path/to/libfoo.a 2. Something like: -largs -Wl,-Bstatic -lfoo -lbar -Wl,-Bdynamic The latter will switch the linker to static mode, link in the libraries you specify and then switch it back to dynamic linking for the rest of the command line (i.e. the part that gets added automatically for the GNAT runtime etc). Note also that the latter will probably only work on systems that have the GNU linker and you may have to replace -Bstatic and -Bdynamic by something else on other (i.e. non-Linux) OSes. |
|
|||
|
On Wed, 22 Feb 2012 19:29:57 +0000 (UTC), Jan Andres wrote:
> On 2012-02-22, tonyg <tonythegair@gmail.com> wrote: >> On Feb 22, 4:01*pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> >> wrote: >>> On Wed, 22 Feb 2012 07:31:29 -0800 (PST), tonyg wrote: >>> > Whenever I compile some code for a different PC , it asks me for the >>> > runtime libraries for gtk and some others. Is there a way I can link >>> > my executable so the functions used in these libraries are included in >>> > my executable ? >>> >>> You have to link to the static (object) libraries. Whether this would work >>> depends on whether the provider of the library allows static linkage or >>> not. The answer would depend on the target platform and the licensing >>> policy. >>> >>> -- >>> Regards, >>> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de >> >> The librarys are all debian based, things like libgnadecommon and >> libgtk, >> I was really looking for the command to give to gnatmake, I know - >> static option links >> in the gnat runtime etc > > If I understand you correctly you have two options: > > 1. Instead of -lfoo specify /full/path/to/libfoo.a > > 2. Something like: -largs -Wl,-Bstatic -lfoo -lbar -Wl,-Bdynamic > > The latter will switch the linker to static mode, link in the libraries > you specify and then switch it back to dynamic linking for the rest of > the command line (i.e. the part that gets added automatically for the > GNAT runtime etc). > > Note also that the latter will probably only work on systems that have > the GNU linker and you may have to replace -Bstatic and -Bdynamic by > something else on other (i.e. non-Linux) OSes. additionally, specifically regarding gtkada, there should be gtkada-config script installed, which spits switches for the linker and compiler. To be used like: $ gnatmake ... -largs `gtkada-config --libs --static` ... See gtkada-config --help -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de |
|
|||
|
In article <qgcucdi2xnvo.18zbqxljktrbk.dlg@40tude.net>,
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote: > additionally, specifically regarding gtkada, there should be > gtkada-config script installed, which spits switches for the linker > and compiler. To be used like: > > $ gnatmake ... -largs `gtkada-config --libs --static` ... > > See gtkada-config --help There's an example Makefile here: <http://home.roadrunner.com/~jbmatthews/gtk/lady.html> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews> |
|
|||
|
"John B. Matthews" <nospam@nospam.invalid> writes:
> In article <qgcucdi2xnvo.18zbqxljktrbk.dlg@40tude.net>, > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote: > >> additionally, specifically regarding gtkada, there should be >> gtkada-config script installed, which spits switches for the linker >> and compiler. To be used like: >> >> $ gnatmake ... -largs `gtkada-config --libs --static` ... >> >> See gtkada-config --help > > There's an example Makefile here: > > <http://home.roadrunner.com/~jbmatthews/gtk/lady.html> I don't think AdaCore are 100% consistent on this, but they have used an environment variable LIBRARY_TYPE to control GPRs: for example, (one of mine), project BC is type Library_T is ("static", "relocatable"); Library_Type : Library_T := external ("LIBRARY_TYPE", "static"); for Library_Name use "bc"; for Library_Kind use Library_Type; for Library_Dir use "../../lib/bc/lib-" & Library_Type; for Externally_Built use "true"; for Source_Dirs use ("../../include/bc/"); end BC; |
|
|||
|
Le 22/02/2012 16:31, tonyg a écrit :
> Whenever I compile some code for a different PC , it asks me for the > runtime libraries for gtk and some others. Is there a way I can link > my executable so the functions used in these libraries are included in > my executable ? I assume you are using GtkAda on Windows. GTKAda requires several DLL for the C libraries GLib, Pango, Cairo, ATK, etc .. found in directory GTKADA\bin ( libgtk-win32-2.0-0.dll, libgdk-win32-2.0-0.dll ..) You have to ship these DLLs with the application (about 10 Mega) The switch in scenario (static, relocatable) applies only to the Ada part i.e. the Gnat Run-Time and GTKAda. these DLLs are libgtkada-2.18.dll and libgnat-2011.dll If you build with static you have the Ada run-time and GTKADa in the executable (which explains the size of at least 1 Mo) With relocatable you must ship also the corresponding DLLs for Ada. |
|
|||
|
On Wednesday, February 22, 2012 3:31:29 PM UTC, tonyg wrote:
> Whenever I compile some code for a different PC , it asks me for the > runtime libraries for gtk and some others. Is there a way I can link > my executable so the functions used in these libraries are included in > my executable ? Thanks for the help from you all here. |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|