You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Everyone,
this is not an "issue" but just useful info which may hopefully end up in improvements to the script, but in the mean time, here it is in text form:
Xcode 12 blocks compilation of i386, even if you have a working compiler imported that supports i386.
Through painful trial and error, I traced which file you need to change in order to make it work:
GCC 4.2 i386 creates linker problems
Once you get i386 working with xcode12, you'll have problems linking, with weird output.
The solution is to use the i386 assembler from xcode 3.2.6 and replace the one in xcode12 that XcodeLegacy.sh has put in
go to /Applications/Xcode12.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/i386
rename as to as_old
copy i386 assembler from xcode3.2.6: /Developer/usr/libexec/gcc/darwin/i386/as
GCC 4.2 compiles ppc but resulting binary lists as ppc7400
"ppc" is G3 compatible while "ppc7400" is G4.
After a while I figured out that the compiler provides proper binaries but the final linker messes it up!
The reason is that gcc4.2 links with crt3.o which only has ppc7400 in it. So to solve it, just take crc3.o from gcc4.0 (which is ppc) and merge it into a fat binary with gcc4.2'sn crt3.o. After that you get proper ppc binaries that I confirm work properly on actual G3 devices.
Linker crashes with 'Bus Error 10'
g++-4.2 is called by xcode 12 to link the final binary, and it gives wrong parameters (-target instead of -arch) and some params and environment variables are missing compared to what xcode 3.2.6 does when installed on osx 10.6.8.
So I made a python script that you replace g++-4.2 with to intercept and transform linker calls and forward them to the old binary. File attached
Instructions:
rename g++-4.2 into g++-4.2_old, xcode 12 calls it with wrong arguments when linking so we have to put our middleman script in it's place to handle that
extract hacked_linker_g++-4.2.zip, it'll create a file 'g++-4.2', put in where the old one was. it's a python script
make it executable using chmod +x <path_to_g++-4.2>
Libtool merges ppc and ppc7400 when creating a fat binary
If you need to compile a binary that has G3 and G4 code separate, then you'll find that libtool messes this up, with many warnings. Basically it removes ppc7400 and just leaves in ppc. To solve this, you'll need to replace libtool file in xcode12's gcc toolchain with a script that uses "lipo" instead of libtool when this situation is detected. I'm attaching a python script I wrote.
Go to /Applications/Xcode12.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
rename libtool to libtool_old
put my script there as 'libtool' and make it executable
That's it from me, let me know if you run into any further trouble and I'll try to help out, I spent 2 days on this, but in the end I have a working xcode12 that I use to compile for powerpc, i386 and x86_64, targeting osx 10.4 and it works like a charm! Thanks xcodelegacy! Hope my contribution will have value to someone else :)
Hi Everyone,
this is not an "issue" but just useful info which may hopefully end up in improvements to the script, but in the mean time, here it is in text form:
Xcode 12 blocks compilation of i386, even if you have a working compiler imported that supports i386.
Through painful trial and error, I traced which file you need to change in order to make it work:
GCC 4.2 i386 creates linker problems
Once you get i386 working with xcode12, you'll have problems linking, with weird output.
The solution is to use the i386 assembler from xcode 3.2.6 and replace the one in xcode12 that XcodeLegacy.sh has put in
GCC 4.2 compiles ppc but resulting binary lists as ppc7400
"ppc" is G3 compatible while "ppc7400" is G4.
After a while I figured out that the compiler provides proper binaries but the final linker messes it up!
The reason is that gcc4.2 links with crt3.o which only has ppc7400 in it. So to solve it, just take crc3.o from gcc4.0 (which is ppc) and merge it into a fat binary with gcc4.2'sn crt3.o. After that you get proper ppc binaries that I confirm work properly on actual G3 devices.
commands:
Linker crashes with 'Bus Error 10'
g++-4.2 is called by xcode 12 to link the final binary, and it gives wrong parameters (-target instead of -arch) and some params and environment variables are missing compared to what xcode 3.2.6 does when installed on osx 10.6.8.
So I made a python script that you replace g++-4.2 with to intercept and transform linker calls and forward them to the old binary. File attached
Instructions:
Libtool merges ppc and ppc7400 when creating a fat binary
If you need to compile a binary that has G3 and G4 code separate, then you'll find that libtool messes this up, with many warnings. Basically it removes ppc7400 and just leaves in ppc. To solve this, you'll need to replace libtool file in xcode12's gcc toolchain with a script that uses "lipo" instead of libtool when this situation is detected. I'm attaching a python script I wrote.
That's it from me, let me know if you run into any further trouble and I'll try to help out, I spent 2 days on this, but in the end I have a working xcode12 that I use to compile for powerpc, i386 and x86_64, targeting osx 10.4 and it works like a charm! Thanks xcodelegacy! Hope my contribution will have value to someone else :)
Attachments:
hacked_libtool.zip
hacked_linker_g++-4.2.zip
The text was updated successfully, but these errors were encountered: