Page 1 of 1

Cross Compiler in Cygwin without Cygwin DLL?

Posted: Tue Apr 21, 2009 7:51 pm
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.

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Tue Apr 21, 2009 8:22 pm
by pcmattman
Why don't you want it linked against the Cygwin DLL?

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Wed Apr 22, 2009 4:46 am
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).

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Wed Apr 22, 2009 5:15 am
by AJ

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Wed Apr 22, 2009 3:11 pm
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.

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Wed Apr 22, 2009 3:59 pm
by bewing
Am I understanding you to say that you want to compile GCC/binutils to run as DOS apps in DOS windows?

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Wed Apr 22, 2009 4:29 pm
by frank
I want them to run on windows as console programs that don't depend on the Cygwin dlls.

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Wed Apr 22, 2009 9:05 pm
by Brynet-Inc
MinGW+MSYS might be able to compile binutils and GCC.

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Thu Apr 23, 2009 12:28 am
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>

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Thu Apr 23, 2009 8:30 am
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.

Re: Cross Compiler in Cygwin without Cygwin DLL?

Posted: Thu Apr 23, 2009 6:27 pm
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...