Cross compiler issue: ld 2.25, gcc 4.9.3

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
Rival
Posts: 11
Joined: Sat Feb 05, 2011 6:05 am
Location: I gotta go

Cross compiler issue: ld 2.25, gcc 4.9.3

Post by Rival »

Host system:
gcc 4.9.3 : x86_64-pc-cygwin
ld 2.25

Target system:
gcc 4.9.3 : i686-elf
ld 2.25

And here goes the problem - binutils compile without any issues wheras gcc bumps out with this error:
fail (msg, strlen (msg), "stack smashing detected: terminated");
^
../../../gcc-4.9.3/libssp/ssp.c:169:3: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
../../../gcc-4.9.3/libssp/ssp.c:169:14: warning: incompatible implicit declaration of built-in function 'strlen'
fail (msg, strlen (msg), "stack smashing detected: terminated");
^
../../../gcc-4.9.3/libssp/ssp.c: In function '__chk_fail':
../../../gcc-4.9.3/libssp/ssp.c:176:14: warning: incompatible implicit declaration of built-in function 'strlen'
fail (msg, strlen (msg), "buffer overflow detected: terminated");
^
Makefile:459: recipe for target 'ssp.lo' failed
make[3]: *** [ssp.lo] Error 1
make[3]: Leaving directory '/usr/src/build-gcc/i686-elf/libssp'
Makefile:328: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/usr/src/build-gcc/i686-elf/libssp'
Makefile:10002: recipe for target 'all-target-libssp' failed
make[1]: *** [all-target-libssp] Error 2
make[1]: Leaving directory '/usr/src/build-gcc'
Makefile:844: recipe for target 'all' failed
make: *** [all] Error 2

I started off on my own experience to build a cross compiler. Binutils compiled successfully whereas gcc stalled at the same place every time. Then flushed out whole Cygwin package, removed any trace of cygwin and went on to read the wiki page to see if I'm missing something. In fact, to be sure, I followed every single step and installed all the necessary packages, as mentioned. Guess what? This time, ld won't even compile. So I'd to fix all the dependency issues manually as it seems that article doesn't cover all required packages at all (for e.g diffutils). Now that I've got ld to compile, I'm pretty much same with gcc. Same error. I'm tempted to say this is incompatibility issue unless someone has something else to say.

I'm going for a fallback to version 4.92. This is pretty much a waste of time, so I ask, "Has anyone managed to get gcc 4.9.3 & ld 2.25 working?"
Rival
Posts: 11
Joined: Sat Feb 05, 2011 6:05 am
Location: I gotta go

Re: Cross compiler issue: ld 2.25, gcc 4.9.3

Post by Rival »

Well, it seems more like Cygwin issue.

Few months back, I built a Cross-compiler under Windows 7. It was readily portable as all I had to do was tuck in few Cygwin dll files with the cross-compiled binaries and then it'd run on any windows 7 machine. But now that I've upgraded to windows 10, this no longer works and that is quite expected as Cygwin developers use nasty patches to make things work. But the problem doesn't seem to end there. After some hours of work, I got the cross-compiler to build successfully, but it simply doesn't work. Initially, it fired undefined reference to spawn() but I managed to fix that by adding Cygwin environment to path variable manually. Then there are bunch of more errors. Every time I fixed an error, I'd find another waiting in the queue. Few more hours of struggling and then I finally made a sane decision to just give up (and save some time thereby).

Cygwin had its issue then. It seems as if the trend follows even to this day. In most cases, the problem is with the installer itself rather than the installed Cygwin package, as missing Cygwin environment variable in the system path makes it quite obvious. This behavior isn't consistent because complete removal and reinstall sometimes fixes this issue. I'm starting to think Cygwin maintainers are really lazy.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Freenode IRC: maxdev
Location: Germany
Contact:

Re: Cross compiler issue: ld 2.25, gcc 4.9.3

Post by max »

Hey, please post the exact commands you used when trying to compile the toolchain.
Post Reply