OSDev.org
https://forum.osdev.org/

Cross compiler issue: ld 2.25, gcc 4.9.3
https://forum.osdev.org/viewtopic.php?f=8&t=29626
Page 1 of 1

Author:  Rival [ Sun Sep 20, 2015 4:33 am ]
Post subject:  Cross compiler issue: ld 2.25, gcc 4.9.3

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:
Quote:
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?"

Author:  Rival [ Sun Sep 20, 2015 8:36 am ]
Post subject:  Re: Cross compiler issue: ld 2.25, gcc 4.9.3

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.

Author:  max [ Sun Sep 20, 2015 11:04 am ]
Post subject:  Re: Cross compiler issue: ld 2.25, gcc 4.9.3

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

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/