Author Topic: Built gcc out of saurik llvm-gcc  (Read 699 times)

LeoTh3o

  • Full Member
  • ***
  • Posts: 230
  • Reputation: 43
    • ET&C
  • Computers: MacBook Pro 15', half 2009, OS X 10.8.1
  • iDevices: iPod 3G iOS 5.1.1; iPad 2 WiFi iOS 5.1.1 jb
Built gcc out of saurik llvm-gcc
« on: September 15, 2012, 06:55:55 am »
Back again, and this time with a compiler. I have rebuilt gcc out of the llvm-gcc-4.2.tgz from Saurik's site. I'll package as soon as possible.

What is different from standard gcc?

Known bugs:
I have not been able to make gcc search in /usr/local/include and /usr/include by default - you'll have to set them in CFLAGS. I'm open to solutions, anyway.
I haven't tested it much.


Download: http://etandc.x11s.org/cydia/odcctools-r_782_iphoneos-arm.deb
                 http://etandc.x11s.org/cydia/gcc-r_4.2.1_iphoneos-arm.deb
« Last Edit: September 15, 2012, 08:34:27 am by LeoTh3o »
0xEB        0xFE
jmp short -2

Trcx528

  • Haxor
  • Hero Member
  • *****
  • Posts: 4502
  • Reputation: 166
  • Google it!
    • iNinjas
  • Badges:
  • Computers: 13" 2011 Macbook Pro, 120 GB SSD and 16 GB of Ram
  • iDevices: None
Re: Built gcc out of saurik llvm-gcc
« Reply #1 on: September 15, 2012, 12:13:13 pm »
Very cool! I'll have to use this for future ports! It might be worth adding a script to set cflags and stuff to /etc/profile.d

marcolz

  • Newbie
  • Posts: 2
  • Reputation: 0
Re: Built gcc out of saurik llvm-gcc
« Reply #2 on: October 02, 2012, 08:05:37 am »
Nice work, but where did you get your libintl from ?

I get:
Code: [Select]
dyld: Library not loaded: /usr/local/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/gcc
  Reason: Incompatible library version: gcc requires version 10.0.0 or later, but libintl.8.dylib provides version 9.0.0

Apart from the binaries not having been
Code: [Select]
ldid -S-ed  ;)

LeoTh3o

  • Full Member
  • ***
  • Posts: 230
  • Reputation: 43
    • ET&C
  • Computers: MacBook Pro 15', half 2009, OS X 10.8.1
  • iDevices: iPod 3G iOS 5.1.1; iPad 2 WiFi iOS 5.1.1 jb
Re: Built gcc out of saurik llvm-gcc
« Reply #3 on: October 02, 2012, 09:08:27 am »
Here it is the file. That is dependencies of gcc I didn't notice. gcc rely on libiconv and libintl (gettext). If you don't have a copy of the libintl library, I'll pass you mine.

Please rename the file by removing the txt part as phpbb doesn't allow to upload .dylib

You can also build (with another copy of gcc) your own version of get text, though.
0xEB        0xFE
jmp short -2

Ironman

  • Administrator
  • Hero Member
  • *****
  • Posts: 5099
  • Reputation: 251
  • Badges:
  • Computers: ASUS UL50VT
  • iDevices: iPhone 5, iPhone 4S, iPhone 4, iPhone 3GS
Re: Built gcc out of saurik llvm-gcc
« Reply #4 on: October 02, 2012, 06:45:51 pm »
Cool!! Nice work!! +1
Click for How to Add Our Repo
If you're going to ask questions....
At least make them good ones.

Knowledge is the one thing that can never be taken from you

Don't like seeing ads? Click here to register!

LeoTh3o

  • Full Member
  • ***
  • Posts: 230
  • Reputation: 43
    • ET&C
  • Computers: MacBook Pro 15', half 2009, OS X 10.8.1
  • iDevices: iPod 3G iOS 5.1.1; iPad 2 WiFi iOS 5.1.1 jb
Re: Built gcc out of saurik llvm-gcc
« Reply #5 on: October 03, 2012, 02:16:11 am »
If someone is missing a library for any reason, please check here
0xEB        0xFE
jmp short -2

LeoTh3o

  • Full Member
  • ***
  • Posts: 230
  • Reputation: 43
    • ET&C
  • Computers: MacBook Pro 15', half 2009, OS X 10.8.1
  • iDevices: iPod 3G iOS 5.1.1; iPad 2 WiFi iOS 5.1.1 jb
Re: Built gcc out of saurik llvm-gcc
« Reply #6 on: November 04, 2012, 09:27:33 am »
After revisiting a bit, I managed to get gfortran built too. I'll need sometime to pack things, but here are the languages that will be available:
  • c
  • c++
  • objc
  • objc++
  • java
  • fortran
Theoretically, there's still treelang available in the configure, but it's broken when make gets to build it.

PS: The package will place itself in /var/root/usr/

Again, I cannot grant it to be stable and fully functional, but it has passed all the stages of rebuilding (for those not confident in how gcc build itself, I mean I have built gcc a first time using Saurik gcc, then I got the result and built gcc anew two times. In this way gcc should profile itself and make errors pop up)
« Last Edit: November 04, 2012, 10:00:19 am by LeoTh3o »
0xEB        0xFE
jmp short -2

Trcx528

  • Haxor
  • Hero Member
  • *****
  • Posts: 4502
  • Reputation: 166
  • Google it!
    • iNinjas
  • Badges:
  • Computers: 13" 2011 Macbook Pro, 120 GB SSD and 16 GB of Ram
  • iDevices: None
Re: Built gcc out of saurik llvm-gcc
« Reply #7 on: November 04, 2012, 09:41:11 pm »
Awesome! I hope to see a deb soon, have a compiler that works well would be really nice. :D

LeoTh3o

  • Full Member
  • ***
  • Posts: 230
  • Reputation: 43
    • ET&C
  • Computers: MacBook Pro 15', half 2009, OS X 10.8.1
  • iDevices: iPod 3G iOS 5.1.1; iPad 2 WiFi iOS 5.1.1 jb
Re: Built gcc out of saurik llvm-gcc
« Reply #8 on: November 05, 2012, 01:14:02 pm »
Now available bundled with some of the cctools at http://etandc.x11s.org/cydia/llvm-gcc_4.2.1_iphoneos-arm.deb
Edit: Some of the ccutils doesn't work (segfault). Just remove them to use the old odcctools, I'll try to fix ASAP.
« Last Edit: November 06, 2012, 09:14:55 am by LeoTh3o »
0xEB        0xFE
jmp short -2

LeoTh3o

  • Full Member
  • ***
  • Posts: 230
  • Reputation: 43
    • ET&C
  • Computers: MacBook Pro 15', half 2009, OS X 10.8.1
  • iDevices: iPod 3G iOS 5.1.1; iPad 2 WiFi iOS 5.1.1 jb
Re: Built gcc out of saurik llvm-gcc
« Reply #9 on: November 10, 2012, 03:34:17 am »
Just one random thing: while the package call itself as llvm-gcc, the llvm bits aren't enabled as it's not included. I spent some time trying to figure out how Apple does things, and here's what I've got:

Referring to the llvm-gcc available at opensource.apple.com/tarballs/llvmgcc42, Apple first build llvmCore, which is included into the package. It's an old and customized version, but there's no easy way to update it to a newer version.
The second step is to build llvm-gcc using --enable-llvm=/llvm/obj/path. Note that you cannot use the object dir of cmake, which is frustrating.

Apple's llvm-gcc used to build the applications in Xcode has this hardcoded:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2 -v
Using built-in specs.
Target: arm-apple-darwin10
Configured with: /private/var/tmp/llvmgcc42_Embedded/llvmgcc42_Embedded-2410.2~115/src/configure --enable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --disable-tls --build=i686-apple-darwin10 --enable-llvm=/private/var/tmp/llvmgcc42_Embedded/llvmgcc42_Embedded-2410.2~115/dst-llvmCore/Developer/usr/local --program-prefix=arm-apple-darwin10- --host=x86_64-apple-darwin10 --target=arm-apple-darwin10 --with-gxx-include-dir=/usr/include/c++/4.2.1 --with-build-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.Internal.sdk
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2410.2.00)

This mainly mean that it's almost impossible to tell on what is exactly based, and also show that this version is more recent than the latest available in their site as source code. They also seem to make use of iPhoneOS Internals, which isn't being distributed, but it should be possible to replace it using reverse tools like classdump to find the headers or recycle them from the mac SDK.
0xEB        0xFE
jmp short -2

Don't like seeing ads? Click here to register!