[ Solved ] Windows 7 x64 ( Cross Compiler ) NO Libs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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.
Learn to read.
Kortath
Member
Member
Posts: 57
Joined: Sat Sep 07, 2013 11:23 am

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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.
Learn to read.
Kortath
Member
Member
Posts: 57
Joined: Sat Sep 07, 2013 11:23 am

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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.
Learn to read.
Kortath
Member
Member
Posts: 57
Joined: Sat Sep 07, 2013 11:23 am

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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]
Last edited by Combuster on Wed Sep 11, 2013 2:53 pm, edited 1 time in total.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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

Code: Select all

mov eax, 0xdeadbeef
int 33
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                      ......!
Learn to read.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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)
Learn to read.
User avatar
beyondsociety
Member
Member
Posts: 39
Joined: Tue Oct 17, 2006 10:35 pm
Location: Eagle, ID (USA)
Contact:

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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.
"I think it may be time for some guru meditation"
"Barbarians don't do advanced wizardry"
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post by gerryg400 »

Kortath, what's the latest status ?
If a trainstation is where trains stop, what is a workstation ?
Kortath
Member
Member
Posts: 57
Joined: Sat Sep 07, 2013 11:23 am

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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.
Last edited by Kortath on Wed Sep 11, 2013 2:49 pm, edited 1 time in total.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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. :oops:

It's still good manners to do it properly, if anything.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Kortath
Member
Member
Posts: 57
Joined: Sat Sep 07, 2013 11:23 am

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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. :oops:

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
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Windows 7 x64 ( Cross Compiler ) NO Libs

Post 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.
If a trainstation is where trains stop, what is a workstation ?
Post Reply