Page 5 of 6
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 10:05 am
by dozniak
The working binutils build I have used the following configure line:
Code: Select all
../../sources/binutils-${BINUTILS_VER}/configure --prefix=$PREFIX --target=$TARGET --program-prefix=$TARGET- \
--disable-werror \
--enable-gold --enable-plugins \
--disable-nls --disable-shared --disable-multilib
I don't know if that improves your experience or not.
If you want to make the logs easier to decypher, drop the -j4 for the make command - it makes logs easier to parse.
I can see some unix essential commands like diff are not found - make sure your cygwin installation is complete for development. (diff, bison, flex)
This seems to be the actual error:
configure: error: in `/home/JMan/binutils-build-2.23.1/ld':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
config.log might've been turned into the mess by -j4 as well, so I'd re-run with make -j1 and then inspected the config.log file for the actual error. Then Google.
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 10:08 am
by Kortath
dozniak wrote:The working binutils build I have used the following configure line:
Code: Select all
../../sources/binutils-${BINUTILS_VER}/configure --prefix=$PREFIX --target=$TARGET --program-prefix=$TARGET- \
--disable-werror \
--enable-gold --enable-plugins \
--disable-nls --disable-shared --disable-multilib
I don't know if that improves your experience or not.
If you want to make the logs easier to decypher, drop the -j4 for the make command - it makes logs easier to parse.
I can see some unix essential commands like diff are not found - make sure your cygwin installation is complete for development. (diff, bison, flex)
This seems to be the actual error:
configure: error: in `/home/JMan/binutils-build-2.23.1/ld':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
config.log might've been turned into the mess by -j4 as well, so I'd re-run with make -j1 and then inspected the config.log file for the actual error. Then Google.
Will do. Thanks for looking at this for me. I'll report back what I end up with next.
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 10:09 am
by dozniak
Kortath wrote:dozniak wrote:You don't need the multiboot header if you're not using multiboot. Is this just a blind copypaste?
Yes the whole thing is complete from start to finish.
I was actually talking about the boot up asm file.
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 10:14 am
by Kortath
dozniak wrote:Kortath wrote:dozniak wrote:You don't need the multiboot header if you're not using multiboot. Is this just a blind copypaste?
Yes the whole thing is complete from start to finish.
I was actually talking about the boot up asm file.
Ohhh.. no no.. I pulled parts from all over trying to gain an understanding of what this does. So this is a "hack Job" of my own.
EDIT UPDATE : This is what I am attempting to use from your idea..
Code: Select all
../binutils-2.23.1/configure --prefix=$PREFIX --target=$TARGET --program-prefix=$TARGET --disable-werror --enable-gold --enable-plugins --disable-nls --disable-shared --disable-multilib
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 10:17 am
by dozniak
Kortath wrote:Ohhh.. no no.. I pulled parts from all over trying to gain an understanding of what this does. So this is a "hack Job" of my own.
Alright then, if you don't use multiboot either, then the section directive doesn't have to be there indeed.
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 10:24 am
by Kortath
OK, I tried once more.. I added
diff and
flex and
bison as per your suggestion. Here is the error again, but slightly different from the last one...
What I am seeing a pattern of here is that I am not sure what all libraries / dependencies it needs. It could be the problem this whole time from the beginning of this thread. And that is with me following the tutorials as close as I can get it.
As you can see I ran
make -j 1 all
http://pastebin.com/raw.php?i=W78GU676
EDIT UPDATE : I tried again just for the sake of completeness to use the command
make all and it came up with the same error. I'm not sure what I am missing at this point. And I am wondering what dependencies gerryg400 used.
I'll look at the logs and see what I can decipher from it as per your suggestion.
EDIT UPDATE 2 :
In case you can spot what the problem is in my log.. I don't know what I am looking for, so here it is..
http://pastebin.com/raw.php?i=pQ0cahGW
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 11:12 am
by Combuster
Kortath wrote:EDIT UPDATE 2 : Well I took SECTION .text out and sure enough it wasn't needed. It compiled with no errors when I used DJGPP.
And if you used some archaic assembler (you're already using DJGPP so...), everything without section is now probably missing from your final binary.
[edit]As per dozniak, this is not apparently an issue with recent nasm/yasm[/edit]
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 12:17 pm
by dozniak
Combuster wrote:Kortath wrote:EDIT UPDATE 2 : Well I took SECTION .text out and sure enough it wasn't needed. It compiled with no errors when I used DJGPP.
And everything without section is now probably missing from your final binary.
Not really, nasm does default to .text, I've tested it with a simple asm file containing only
After nasm -f elf test.asm I dumped the sections:
Code: Select all
test.o: file format ELF32-i386
Contents of section :
Contents of section .text:
0000 b8efbead decd21 ......!
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 12:23 pm
by dozniak
checking how to run the C++ preprocessor... /lib/cpp
Somehow it tries to use /lib/cpp as the preprocessor. I don't know why, or which system confiruation setting is wrong.
(Also I noted you have copied --program-prefix configure option wrong - it should equal $TARGET- instead of just $TARGET, otherwise you'd get program names like i586-elfld instead of i586-elf-ld)
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 12:40 pm
by beyondsociety
Looked at your most recent config.log and it's missing the m4 package which is needed for autoconf to generate the config files. A few of the gcc tests are also failing for conftest, which I believe ties into m4 as well. Try installing that package and see if it fixes the problem, otherwise post current config.log after doing that. Hope this helps.
I started with djgpp and then used cygwin on win 7 64 bit for quite a while with my own crosscompiler and never had any of your issues. Before I created my own crosscompiler in cgywin, I solved the pe non file format error by assembling to coff and then compiling gcc as pe/bin and converting the file format to elf using objcopy. It solved the issue but generated a larger binary so I would have to strip sections from the binary to get it smaller. Always seemed like a hack but worked perfect, was much easier to compile code once I switched to a crosscompiler.
Switched to linux and haven't looked back. If I have some time today, I'll test your code and see what issues I have on my win 7 64bit machine. The last version of gcc on cygwin I used was 4.7.x so will have to update my tools when I get home from work.
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 2:33 pm
by gerryg400
Kortath, what's the latest status ?
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 2:47 pm
by Kortath
beyondsociety wrote:Looked at your most recent config.log and it's missing the m4 package which is needed for autoconf to generate the config files. A few of the gcc tests are also failing for conftest, which I believe ties into m4 as well. Try installing that package and see if it fixes the problem, otherwise post current config.log after doing that. Hope this helps.
I started with djgpp and then used cygwin on win 7 64 bit for quite a while with my own crosscompiler and never had any of your issues. Before I created my own crosscompiler in cgywin, I solved the pe non file format error by assembling to coff and then compiling gcc as pe/bin and converting the file format to elf using objcopy. It solved the issue but generated a larger binary so I would have to strip sections from the binary to get it smaller. Always seemed like a hack but worked perfect, was much easier to compile code once I switched to a crosscompiler.
Switched to linux and haven't looked back. If I have some time today, I'll test your code and see what issues I have on my win 7 64bit machine. The last version of gcc on cygwin I used was 4.7.x so will have to update my tools when I get home from work.
OK m4 package installed. Thanks for that.
dozniak wrote:checking how to run the C++ preprocessor... /lib/cpp
Somehow it tries to use /lib/cpp as the preprocessor. I don't know why, or which system confiruation setting is wrong.
(Also I noted you have copied --program-prefix configure option wrong - it should equal $TARGET- instead of just $TARGET, otherwise you'd get program names like i586-elfld instead of i586-elf-ld)
--program-prefix is now fixed with the added - ( minus ) sign.
but still same error.
My console :
http://pastebin.com/raw.php?i=DfuwxbXd
My log file :
http://pastebin.com/raw.php?i=aqmx4pa1
gerryg400 wrote:Kortath, what's the latest status ?
I'm still working with your script and same versions as you are, and its still not working.
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 2:48 pm
by Combuster
dozniak wrote:Not really, nasm does default to .text, I've tested it (...)
Serves me for still believing one has to avoid the issues that existed five years ago.
It's still good manners to do it properly, if anything.
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 2:51 pm
by Kortath
Combuster wrote:dozniak wrote:Not really, nasm does default to .text, I've tested it (...)
Serves me for still believing one has to avoid the issues that existed five years ago.
It's still good manners to do it properly, if anything.
I am curious where it should go if what your saying is that it is needed. If its not needed, then I'm confused by your comment.
Here is my linker.ld script after all these posts so far.
Code: Select all
global start
extern main
[BITS 32]
start:
call main
cli
hlt
EXTERN code, bss, end
ALIGN 4
mboot:
dd mboot
dd code
dd bss
dd end
dd start
Re: Windows 7 x64 ( Cross Compiler ) NO Libs
Posted: Wed Sep 11, 2013 3:01 pm
by gerryg400
Kortath, do you have g++ installed in Cygwin ? What happens if you type g++ from your Cygwin command line ?
the wiki page on Cross Compiling wrote:C++ preprocessor "/lib/cpp" fails sanity check in Cygwin when building Binutils
In Cygwin's installer, you need to separately select the gcc4-core and gcc4-g++ packages for proper configuration of the host compiler.