Author Topic: Setting up a proper toolcahin  (Read 2768 times)

BooCocky

  • Leader
  • Hero Member
  • *****
  • Posts: 875
  • Reputation: 81
  • All your base are belong to ininjas
  • Badges:
  • Computers: Dell Inspirion
  • iDevices: ipod shuffle
Re: Setting up a proper toolcahin
« Reply #15 on: March 02, 2012, 12:51:32 pm »
this is because some configure scripts try running a.out to test and see if the machine can run the executable.  iOS > 4.3 has made the ability to use sysctl and disable the codesign impossible due to kernel being "read only".....dont know if this has been mentioned yet, didnt read entire thread.  The work around is to find the part of the configure script that tries to run a.out and delete it. 

however,  if you would like to disable codesigning completely.  You may be able to with redsn0w,  if you use redsn0w to set bootargs you can use

Code: [Select]
cs_enforcement_disable
Which gives the ability to get around codesigning.  I havent tried it (yet) but im almost positive it works. 

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: Setting up a proper toolcahin
« Reply #16 on: March 14, 2012, 02:49:00 am »
Unfortunately redsn0w isn't an option with ipad 2. I wonder if something could be done from Mac such as properly signing the executables...
Besides, it's not a fail with configure, but with make test which happens also at runtime. I mailed saurik more times but never got anything back.
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: Setting up a proper toolcahin
« Reply #17 on: March 14, 2012, 08:36:25 am »
You can fake code sign using ldid on OS X.  http://dl.dropbox.com/u/3157793/ldid

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: Setting up a proper toolcahin
« Reply #18 on: March 14, 2012, 02:48:50 pm »
Doing things in order:
1) there's a known bug in mac with apr that has been inherited by iOS:
case $host in
            *-apple-darwin[0-9].*)
                # APR's use of kqueue has triggered kernel panics for some
                # 10.5.x (Darwin 9.x) users when running the entire test suite.
                # In 10.4.x, use of kqueue would cause the socket tests to hang.
                # 10.6+ (Darwin 10.x is supposed to fix the KQueue issues
if test -z "$ac_cv_func_kqueue"; then
    test "x$silent" != "xyes" && echo "  setting ac_cv_func_kqueue to \"no\""
    ac_cv_func_kqueue="no"
  fi


  if test -z "$ac_cv_func_poll"; then
    test "x$silent" != "xyes" && echo "  setting ac_cv_func_poll to \"no\""
    ac_cv_func_poll="no"
  fi
 # See issue 34332
            ;;



which is no more disabled for darwin≥10. iOS now is darwin11 and despite this, it's still buggy for kqueue and poll. If the ./configure isn't edited you'll go nowhere at build time.

2)signing the packages from mac and from iOS shouldn't be all that different. Anyway, apr has only one executable (apr-1-config) which I run without problems as it's a mere shell script.
For those interested here's a deb with apr on a nonstandard location so that you won't mess with saurik's one.

3)if it was a code signing error it should be SIGKILL (9) and not SIGSYS (11). SIGSYS is defined as bad system call which is not exactly the same thing.
Trying proc mutexes with mechanism `default'...
/bin/sh: line 2: 44054 Bad system call: 12     ./$prog
testatomic          : SUCCESS
testdir             : SUCCESS
testdso             : SUCCESS
testdup             : SUCCESS
testenv             : SUCCESS
testfile            : SUCCESS
testfilecopy        : SUCCESS
testfileinfo        : SUCCESS
testflock           : SUCCESS
testfmt             : SUCCESS
testfnmatch         : SUCCESS
testargs            : SUCCESS
testhash            : SUCCESS
testipsub           : SUCCESS
testlock            : SUCCESS
testcond            : SUCCESS
testlfs             : SUCCESS
testmmap            : SUCCESS
testnames           : SUCCESS
testoc              : SUCCESS
testpath            : SUCCESS
testpipe            : SUCCESS
testpoll            : SUCCESS
testpools           : SUCCESS
testproc            : SUCCESS
testprocmutex       : -/bin/sh: line 2: 44072 Bad system call: 12     ./$prog
Programs failed: testmutexscope testall
make[1]: *** [check] Error 140
make[1]: Leaving directory `/private/var/root/apr/apr-1.4.5/test'
make: *** [check] Error 2
« Last Edit: March 14, 2012, 03:48:41 pm 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: Setting up a proper toolcahin
« Reply #19 on: May 16, 2012, 01:53:12 pm »
Erm... I had to restore due a mistype I did... I indended to move some file into /var, but I typed rm instead of mv, so the whole system was unable to run or boot...
I'm getting this error:

Undefined symbols:
  "_main", referenced from:
      _main$non_lazy_ptr in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I'm just reconfiguring gcc. Please help as I tried substituting from /var/sdk and from SDK5.1 and all got this result.
With the original symlink /usr/lib/crt1.10.5.o ->/usr/lib/crt1.o I had this:

Undefined symbols:
  "_main", referenced from:
      __start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
0xEB        0xFE
jmp short -2

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

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: Setting up a proper toolcahin
« Reply #20 on: May 16, 2012, 02:41:25 pm »
That means that the program you are trying to run isn't executable. All executables must have a main function, but that one does not.

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: Setting up a proper toolcahin
« Reply #21 on: May 16, 2012, 03:05:46 pm »
Thanks a lot. Instead of trying ./configure or testfiles, I was trying random .c files from packages.
0xEB        0xFE
jmp short -2

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: Setting up a proper toolcahin
« Reply #22 on: May 16, 2012, 03:16:41 pm »
Most .c files in sources do not contain a main function, as only one will.

To compile a .c file that doesn't contain a main function into an object file, do this:

gcc -o file.o file.c

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: Setting up a proper toolcahin
« Reply #23 on: July 28, 2012, 05:45:45 am »
Hello, I'm back with a new kind of problem.
Since i got fed up of signing all binaries on iOS 5.1.1 I downgraded my iPad to 5.0.1.
After setting up gcc I tried something like this as a test
$ gcc -c test.c -o test -v
Using built-in specs.
Target: arm-apple-darwin9
Configured with: ../llvm-gcc-4.2/configure --build=x86_64-unknown-linux-gnu --host=arm-apple-darwin
9 --enable-static=no --enable-shared=yes --prefix=/usr --localstatedir=/var/cache/iphone-gcc --enab
le-languages=c,c++,objc,obj-c++ --enable-wchar_t=no --with-gxx-include-dir=/usr/include/c++/4.0.0
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5555)
 /usr/libexec/gcc/arm-apple-darwin9/4.2.1/cc1 -quiet -v -D__DYNAMIC__ compress.c -fPIC -fno-builtin
-strcat -fno-builtin-strcpy -quiet -dumpbase compress.c -maspen-version-min=2.0 -auxbase-strip test
 -version -o /var/tmp//cc5tkm6f.s
ignoring nonexistent directory "/usr/lib/gcc/arm-apple-darwin9/4.2.1/../../../../arm-apple-darwin9/
include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/arm-apple-darwin9/4.2.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
GNU C version 4.2.1 (Based on Apple Inc. build 5555) (arm-apple-darwin9)
        compiled by GNU C version 4.2.1 (Based on Apple Inc. build 5555).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64382
Compiler executable checksum: 7f3b3f9f41787e32b9fcd64c73e06ffd
 as -arch arm -force_cpusubtype_ALL -o test /var/tmp//cc5tkm6f.s
/var/tmp//cc5tkm6f.s:unknown:FATAL:can't create output file: test

Even clang doesn't like working now:
$ clang -c test.c -o test
error: unable to open output file 'test': 'Error opening output file 'test''

All I know is that this is not a metter of permissions. I'm kinda out of ideas.
0xEB        0xFE
jmp short -2

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: Setting up a proper toolcahin
« Reply #24 on: July 29, 2012, 01:38:32 am »
Have you tried logging in as root first?
Have you installed the compiler using "Compile C Apps iOS4" from insanelyi?

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: Setting up a proper toolcahin
« Reply #25 on: July 29, 2012, 01:29:57 pm »
I always build as root. I resetted it completely, restoring (again) to 5.0.1 and now both gcc and clang works.
0xEB        0xFE
jmp short -2

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: Setting up a proper toolcahin
« Reply #26 on: July 29, 2012, 07:09:48 pm »
Glad its working for you. I asked about root because your command examples started with '$' instead of '#'.