comp.lang.ada
 help / color / mirror / Atom feed
* Some questions on packaging Ada code
@ 2011-03-08 18:14 localhost
  2011-03-08 20:53 ` Nasser M. Abbasi
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: localhost @ 2011-03-08 18:14 UTC (permalink / raw)


Hello all! Is it possible to generate an executable using gcc-ada and
ncurses that doesn't have any dependencies? I'm thinking about providing an
application to people that don't have ada or maybe even gcc installed and
certainly not ncurses. I have Linux as my development system. If the answer
to this question is yes then my next question would be can I generate a
standalone Windows executable from Linux easily enough or should I take the
source over to Windows somehow and build it there. Thanks for your help.



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

* Re: Some questions on packaging Ada code
  2011-03-08 18:14 Some questions on packaging Ada code localhost
@ 2011-03-08 20:53 ` Nasser M. Abbasi
  2011-03-09 10:32   ` localhost
  2011-03-09  0:19 ` R Tyler Croy
  2011-03-09 11:22 ` Ludovic Brenta
  2 siblings, 1 reply; 9+ messages in thread
From: Nasser M. Abbasi @ 2011-03-08 20:53 UTC (permalink / raw)


On 3/8/2011 10:14 AM, localhost@example.org wrote:
> Hello all! Is it possible to generate an executable using gcc-ada and
> ncurses that doesn't have any dependencies? I'm thinking about providing an
> application to people that don't have ada or maybe even gcc installed and
> certainly not ncurses. I have Linux as my development system. If the answer
> to this question is yes then my next question would be can I generate a
> standalone Windows executable from Linux easily enough or should I take the
> source over to Windows somehow and build it there. Thanks for your help.


I am sure you can. I do not see why not. Just link with static libraries
when building your .exe instead of shared ones.

If you are distributing an executable, why one any one need to have gcc on
their end to run your program?gcc is a compiler.

May be I am missing something here.

--Nasser



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

* Re: Some questions on packaging Ada code
  2011-03-08 18:14 Some questions on packaging Ada code localhost
  2011-03-08 20:53 ` Nasser M. Abbasi
@ 2011-03-09  0:19 ` R Tyler Croy
  2011-03-09 10:33   ` localhost
  2011-03-09 11:22 ` Ludovic Brenta
  2 siblings, 1 reply; 9+ messages in thread
From: R Tyler Croy @ 2011-03-09  0:19 UTC (permalink / raw)


localhost@example.org wrote:
> Hello all! Is it possible to generate an executable using gcc-ada and
> ncurses that doesn't have any dependencies? I'm thinking about providing an
> application to people that don't have ada or maybe even gcc installed and
> certainly not ncurses. I have Linux as my development system. If the answer
> to this question is yes then my next question would be can I generate a
> standalone Windows executable from Linux easily enough or should I take the
> source over to Windows somehow and build it there. Thanks for your help.

You would certainly need to either cross-compile for Windows or build on
Windows directly. Windows and Linux have different executable and library
formats, so even if the Ada code is portable between the platforms, the
libraries and runtimes won't be

-- 
- R. Tyler Croy
--------------------------------------
    Code: http://github.com/rtyler



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

* Re: Some questions on packaging Ada code
  2011-03-08 20:53 ` Nasser M. Abbasi
@ 2011-03-09 10:32   ` localhost
  0 siblings, 0 replies; 9+ messages in thread
From: localhost @ 2011-03-09 10:32 UTC (permalink / raw)


> I am sure you can. I do not see why not. Just link with static libraries
> when building your .exe instead of shared ones.

Yes but how? What do I add to the gnatmake command line to make a static
executable? 

> If you are distributing an executable, why one any one need to have gcc on
> their end to run your program?gcc is a compiler.
>
> May be I am missing something here.

To explain a bit more whether someone has gcc or not I was talking about the
runtime for Ada being available because I read gcc-ada needs the runtime
available and I don't know if you can link it staticly and if so, how.



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

* Re: Some questions on packaging Ada code
  2011-03-09  0:19 ` R Tyler Croy
@ 2011-03-09 10:33   ` localhost
  2011-03-09 10:44     ` Nasser M. Abbasi
  0 siblings, 1 reply; 9+ messages in thread
From: localhost @ 2011-03-09 10:33 UTC (permalink / raw)


>> can I generate a standalone Windows executable from Linux easily enough
>> or should I take the source over to Windows somehow and build it
>> there. Thanks for your help.
>
> You would certainly need to either cross-compile for Windows or build on
> Windows directly. Windows and Linux have different executable and library
> formats, so even if the Ada code is portable between the platforms, the
> libraries and runtimes won't be

I realize that which is why I asked can I generate a standalone Windows
executable from Linux easily enough or should I build the source on
Windows. I don't know what steps are involved in cross compiling or if its a
good idea.



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

* Re: Some questions on packaging Ada code
  2011-03-09 10:33   ` localhost
@ 2011-03-09 10:44     ` Nasser M. Abbasi
  2011-03-09 11:29       ` localhost
  0 siblings, 1 reply; 9+ messages in thread
From: Nasser M. Abbasi @ 2011-03-09 10:44 UTC (permalink / raw)


On 3/9/2011 2:33 AM, localhost@example.org wrote:

>
> I realize that which is why I asked can I generate a standalone Windows
> executable from Linux easily enough or should I build the source on
> Windows. I don't know what steps are involved in cross compiling or if its a
> good idea.

Lets back up a little here to make sure all is clear:

(1) I thought you just wanted to build a Linux executable on Linux.

(2) If you wanted to build a windows executable on Linux, then that is
a different matter.

I was answering based on (1) not (2).

To link to a static library instead of a shared one, I normally
just link to the .a version of the library instead of the .so
version.  This is a general statement, there might be specific
things you need to do relating to compiler options and such
depending on which compiler you are using.

If you want to build a windows static executable, then I would do
everything on windows not on Linux. Why make life harder than
it needs to.

--Nasser





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

* Re: Some questions on packaging Ada code
  2011-03-08 18:14 Some questions on packaging Ada code localhost
  2011-03-08 20:53 ` Nasser M. Abbasi
  2011-03-09  0:19 ` R Tyler Croy
@ 2011-03-09 11:22 ` Ludovic Brenta
  2011-03-09 11:36   ` localhost
  2 siblings, 1 reply; 9+ messages in thread
From: Ludovic Brenta @ 2011-03-09 11:22 UTC (permalink / raw)


localhost@example.com wrote on comp.lang.ada:
> Hello all! Is it possible to generate an executable using gcc-ada and
> ncurses that doesn't have any dependencies? I'm thinking about providing an
> application to people that don't have ada or maybe even gcc installed and
> certainly not ncurses. I have Linux as my development system. If the answer
> to this question is yes

Yes.

For the GNAT run-time library, pass the -static option to gnatbind,
like so:

gnatmake [other parameters...] -bargs -static

or using a package Binder in your GNAT project file.

Please read the GNAT User's Guide for your version of GCC[1].

[1] http://gcc.gnu.org/onlinedocs/

For libraries other than the GNAT run-time library (such as ncurses),
simply specify the name of all static libraries necessary on the
command line or in the package Linker of your project file, like so:

gnatmake foo.adb [other options...] \
  -bargs -static \
  -largs /usr/lib/libncurses_ada.a /usr/lib/libncurses.a

or:

with "ncurses_ada";
project Foo is
   package Binder is
      for Default_Switches ("Ada") use ("-static");
   end Binder;
   package Linker is
      for Default_Switches ("Ada")
        use ("/usr/lib/libncurses_ada.a", "/usr/lib/libncurses.a");
   end Linker;
end Foo;

> then my next question would be can I generate a
> standalone Windows executable from Linux easily enough or should I take the
> source over to Windows somehow and build it there. Thanks for your help.

It is possible to cross-compile from a GNU/Linux host to a Windows
target but I am not aware of any binary distribution of the necessary
cross-compiler.  This means you would have to build your own cross-
compiler and cross-libraries from source.  I think this would be more
trouble than it is worth (especially since you seem to be a beginner);
you would be better off installing a native compiler and libraries on
Windows and recompiling your sources on Windows.

Finally, some notes about ncurses:
* the library may not work out of the box on Windows as it needs an
ANSI-compliant terminal.  I'm sure it can be made to work, perhaps
with some tweaking.
* you will need an Ada binding to ncurses, both on GNU/Linux and on
Windows.  Do you have one?  (see also http://bugs.debian.org/615920).

Hope this helps

--
Ludovic Brenta.



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

* Re: Some questions on packaging Ada code
  2011-03-09 10:44     ` Nasser M. Abbasi
@ 2011-03-09 11:29       ` localhost
  0 siblings, 0 replies; 9+ messages in thread
From: localhost @ 2011-03-09 11:29 UTC (permalink / raw)


> Lets back up a little here to make sure all is clear:
>
> (1) I thought you just wanted to build a Linux executable on Linux.

Yes.

> (2) If you wanted to build a windows executable on Linux, then that is
> a different matter.

I was asking how easy or practical it is. If not, I'll attempt to do it on
Windows later.

> To link to a static library instead of a shared one, I normally
> just link to the .a version of the library instead of the .so
> version.  This is a general statement, there might be specific
> things you need to do relating to compiler options and such
> depending on which compiler you are using.

It looks as another poster explained this in more detail. I'm new to all
this so I didn't exactly understand you.

> If you want to build a windows static executable, then I would do
> everything on windows not on Linux. Why make life harder than
> it needs to.

Ok thanks :)



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

* Re: Some questions on packaging Ada code
  2011-03-09 11:22 ` Ludovic Brenta
@ 2011-03-09 11:36   ` localhost
  0 siblings, 0 replies; 9+ messages in thread
From: localhost @ 2011-03-09 11:36 UTC (permalink / raw)


> Yes.
>
> For the GNAT run-time library, pass the -static option to gnatbind,
> like so:
>
> gnatmake [other parameters...] -bargs -static

Oh great! I tried passing -static by itself but it was ignored. I missed the
-bargs part.

> Please read the GNAT User's Guide for your version of GCC[1].
>
> [1] http://gcc.gnu.org/onlinedocs/

I admit I have jumpinitis and didn't read the manuals thoroughly enough at
this point. 
>
> For libraries other than the GNAT run-time library (such as ncurses),
> simply specify the name of all static libraries necessary on the
> command line or in the package Linker of your project file, like so:
>
> gnatmake foo.adb [other options...] \
>   -bargs -static \
>   -largs /usr/lib/libncurses_ada.a /usr/lib/libncurses.a

I figured how to link the ncurses libs but got lucky on the fact ncurses
doesn't seem to generate a shared library (.so as I gather from Nasser's
reply) only the .a libs exist. This is great info I was hoping for.

> It is possible to cross-compile from a GNU/Linux host to a Windows
> target but I am not aware of any binary distribution of the necessary
> cross-compiler.  This means you would have to build your own cross-
> compiler and cross-libraries from source.  I think this would be more
> trouble than it is worth (especially since you seem to be a beginner);

Ok yeah that sounds like a bit much at this point ;)

> you would be better off installing a native compiler and libraries on
> Windows and recompiling your sources on Windows.

Sounds good.
>
> Finally, some notes about ncurses:
> * the library may not work out of the box on Windows as it needs an
> ANSI-compliant terminal.  I'm sure it can be made to work, perhaps
> with some tweaking.

Oh drat I didn't think about that. Maybe we can find one but really a
Windows version is much later because I have other issues.

> * you will need an Ada binding to ncurses, both on GNU/Linux and on
> Windows.  Do you have one?  (see also http://bugs.debian.org/615920).

Yes I've installed ncurses and got a few small samples written. I'm going to
try to actually do something worthwhile if I can now... 

>
> Hope this helps

Very much, thanks indeed!



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

end of thread, other threads:[~2011-03-09 11:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08 18:14 Some questions on packaging Ada code localhost
2011-03-08 20:53 ` Nasser M. Abbasi
2011-03-09 10:32   ` localhost
2011-03-09  0:19 ` R Tyler Croy
2011-03-09 10:33   ` localhost
2011-03-09 10:44     ` Nasser M. Abbasi
2011-03-09 11:29       ` localhost
2011-03-09 11:22 ` Ludovic Brenta
2011-03-09 11:36   ` localhost

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