* RE: True Static Linking
@ 2002-04-16 22:43 Robert Collins
0 siblings, 0 replies; 4+ messages in thread
From: Robert Collins @ 2002-04-16 22:43 UTC (permalink / raw)
To: Westley Weimer, cygwin; +Cc: weimer
> -----Original Message-----
> From: Westley Weimer [mailto:weimer@EECS.Berkeley.EDU]
> Sent: Wednesday, April 17, 2002 1:50 PM
> I am willing to have "hello.exe" be fairly large, but
> shipping all of cygwin1.dll (700K) is not allowed. If this
> were linux I would pull all of the .o files out of cygwin1.a
> (or whatever) and link against a subset of them manually. I
> have no idea how to do this under cygwin.
You can't under linux you would have to ship the vmlinuz file as well -
which is what cygwin1.dll is closest to in this environment.
Rob
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* True Static Linking
2002-04-16 21:31 Westley Weimer
2002-04-16 22:09 ` Sam Edge
@ 2002-04-17 2:23 ` David Starks-Browning
1 sibling, 0 replies; 4+ messages in thread
From: David Starks-Browning @ 2002-04-17 2:23 UTC (permalink / raw)
To: Westley Weimer; +Cc: cygwin
On Tuesday 16 Apr 02, Westley Weimer writes:
> I am using gcc under cygwin and I would like to ship hello.exe to a friend
> who does not have cygwin1.dll on his computer.
> ...
> (1) Is there a "-static" switch that statically links in cygwin1.dll?
Read the FAQ entry "Can I build a Cygwin program that does not require
cygwin1.dll at runtime?"
> (2) If not, how else can I solve this problem?
Have them install Cygwin. If they only want the "cygwin" package from
the Base category, they can de-select all the other packages that
would otherwise be installed by default.
Regards,
David
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: True Static Linking
2002-04-16 21:31 Westley Weimer
@ 2002-04-16 22:09 ` Sam Edge
2002-04-17 2:23 ` David Starks-Browning
1 sibling, 0 replies; 4+ messages in thread
From: Sam Edge @ 2002-04-16 22:09 UTC (permalink / raw)
To: cygwin
> (1) Is there a "-static" switch that statically links in cygwin1.dll?
> (2) If not, how else can I solve this problem?
I'm fairly new to Cygwin but from what I've picked up there is no static version of the cygwin library available either binary or source. This is a deliberate policy to try to ensure that all running Cygwin processes have the same version loaded and are all using the same shared memory and other kernel objects that are required to simulate the UNIX/POSIX API on top of the Win32 one.
If your program really needs things like fork() or native Berkley sockets you could get the source for Cygwin and patch it to generate your own static version. I've no idea how difficult this might be and maintaining it with newer versions would be a headache. (It may be that a DLL is required by the Win32 architecture for some of the features.)
I doubt whether a simple stand-alone executable needs this.
The first thing to do is to try the "-mno-cygwin" switch on gcc as well as making everything else statically linked. You might get away with this providing you're not relying on Cygwin-specific API calls or C++ standard template libraries. (Make sure you've used SETUP.EXE to install the mingw-runtime and w32api packages first.)
If that's not enough, you can go to http://www.colomsat.net.co/freehost/ngiraldo/cppcygwin.html to add the additional C++ STL. This has instructions for ensuring that you get what you need in a painless manner and can create native Win32 applications with the Cygwin GCC tool chain and all the other nice Cygwin
(The other approach is to avoid using Cygwin as the development environment and to download the MinGW Win32-native GCC tols and libraries from http://www.mingw.org/, although this shouldn't be needed if you've configued everything correctly in Cygwin.)
MinGW relies on the Micrsoft MSVCRTx.DLL run-time libraries but these are pretty much universal. There is in fact no such thing as completely static linkage under Windows since you always end up dynamically linking to SYSTEM32, USER32, GDI32 and/or other "universal" Win32 system DLLs. The VC runtime are pretty much in this category.
--
Sam Edge
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* True Static Linking
@ 2002-04-16 21:31 Westley Weimer
2002-04-16 22:09 ` Sam Edge
2002-04-17 2:23 ` David Starks-Browning
0 siblings, 2 replies; 4+ messages in thread
From: Westley Weimer @ 2002-04-16 21:31 UTC (permalink / raw)
To: cygwin; +Cc: weimer
I am using gcc under cygwin and I would like to ship hello.exe to a friend
who does not have cygwin1.dll on his computer.
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
gcc version 2.95.3-5 (cygwin special)
$ gcc hello.c -o hello.exe -static
Unfortunately, this does not work because cygwin1.dll is not present on the
target computer. You can simulate the problem as follows:
$ PATH= ./hello.exe
[ Windows Error Box:
The dynamic link library cygwin1.dll cannot be found in the
path C:\WINNT ... ]
I am willing to have "hello.exe" be fairly large, but shipping all of
cygwin1.dll (700K) is not allowed. If this were linux I would pull all of
the .o files out of cygwin1.a (or whatever) and link against a subset of
them manually. I have no idea how to do this under cygwin.
(1) Is there a "-static" switch that statically links in cygwin1.dll?
(2) If not, how else can I solve this problem?
Thanks!
- Wes
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-04-17 9:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-16 22:43 True Static Linking Robert Collins
-- strict thread matches above, loose matches on Subject: below --
2002-04-16 21:31 Westley Weimer
2002-04-16 22:09 ` Sam Edge
2002-04-17 2:23 ` David Starks-Browning
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).