Cross Compiler in Cygwin without Cygwin DLL?

Programming, for all ages and all languages.
Post Reply
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Cross Compiler in Cygwin without Cygwin DLL?

Post by frank »

I've been searching for a while now for any information on how to build GCC and binutils in Cygwin without linking against the Cygwin DLL. I don't really plan on downloading MinGW and setting up all of that but will if I have to. I've read about a -mno-cygwin option but I've also read it won't work. Any information or links would be greatly appreciated.

I can and have built a cross compiler in cygwin for building ELF files but it is linked against the Cygwin DLL.

Thanks.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by pcmattman »

Why don't you want it linked against the Cygwin DLL?
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by Creature »

I think he's just looking to reduce the dependencies which result in users having to put the cygwin1.dll in the working directory or in the system32 folder. I'm interested in this as well, but fear there is pretty much no alternative since Cygwin stuff needs to be linked in (unless Cygwin can use some sort of static library instead of the dynamic one, which also has its disadvantages).
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by AJ »

frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by frank »

Yes thank you, but that option is mainly for single binaries. Will it work with GCC and Binutils and how would I go about adding that option to the GCC and Binutils compile process? I'm not all that familiar with the ./configure make process.

Can GCC even be compiled unpatched without a POSIX emulation layer below it?
pcmattman wrote:Why don't you want it linked against the Cygwin DLL?
Like Creature said I don't want the Cygwin .dll dependency hanging around. I don't want to have to move the cygwin install around to other computers.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by bewing »

Am I understanding you to say that you want to compile GCC/binutils to run as DOS apps in DOS windows?
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by frank »

I want them to run on windows as console programs that don't depend on the Cygwin dlls.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by Brynet-Inc »

MinGW+MSYS might be able to compile binutils and GCC.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by pcmattman »

Yes thank you, but that option is mainly for single binaries. Will it work with GCC and Binutils and how would I go about adding that option to the GCC and Binutils compile process? I'm not all that familiar with the ./configure make process.

Code: Select all

$ export CFLAGS="-mno-cygwin -O2"
$ ./configure <arguments>
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by Creature »

pcmattman wrote:
Yes thank you, but that option is mainly for single binaries. Will it work with GCC and Binutils and how would I go about adding that option to the GCC and Binutils compile process? I'm not all that familiar with the ./configure make process.

Code: Select all

$ export CFLAGS="-mno-cygwin -O2"
$ ./configure <arguments>
I've taken a look at this myself and tried that as well, but it will sadly fail to compile (at least with binutils 2.19.1). The reason is that if you don't use Cygwin, it will automatically try and use MinGW, but MinGW is missing the 'alloca.h' header which binutils apparently has need for. I could also be missing something here, of course but as said before, I think the easiest would be to simply download MinGW/MSYS and do it with that.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Cross Compiler in Cygwin without Cygwin DLL?

Post by pcmattman »

MinGW lacks the alloca.h header file, instead you should use malloc.h. However, patching up the source may not be your idea of fun. Worst case, create alloca.h (in the standard include directory) and make its only contents "#include <malloc.h>". I can't promise it'll work, but it's worth a shot...
Post Reply