Author Topic: Need to disable codesign  (Read 3409 times)

BooCocky

  • Leader
  • Hero Member
  • *****
  • Posts: 875
  • Reputation: 81
  • All your base are belong to ininjas
  • Badges:
  • Computers: Dell Inspirion
  • iDevices: ipod shuffle
Need to disable codesign
« on: October 25, 2011, 08:22:37 am »
Somewhere between 4.2.1-4.3.5 apple decided to make the sysctl variables that disable codesign check "read only" this means you cant disable them with a simple sysctl command.  Im now on iOS5 and it still exists.  This didnt used to be a real issue, but Ive been getting errors when compiling big programs.  The error I get is in configure

Code: [Select]
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... arm-apple-darwin11.0.0
checking host system type... arm-apple-darwin11.0.0
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C
 compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
w

Here is the issue, configure creates a test program "a.out" then trys to run it but cant because it is not signed, so then it stops because it thinks it cant run c compiled programs.  There needs to be a work around this, either someway to disable codesign another way. Here is the part of the config.log that tells me this is the case:

Code: [Select]
configure:2246: checking whether the C compiler works
configure:2252: ./a.out
./configure: line 2253: 11872 Killed: 9               ./$ac_file
configure:2255: $? = 137
configure:2264: error: cannot run C compiled programs.


only thing I can think of is find the rule in the configure script that runs a.out and sign it before it is run.  Which is kind of a pain in the ass.  Whatch think?

A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4016
  • Reputation: 216
  • Badges:
Re: Need to disable codesign
« Reply #1 on: October 25, 2011, 02:26:52 pm »
Sounds good

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: Need to disable codesign
« Reply #2 on: October 25, 2011, 02:36:28 pm »
can you edit out the part that goes: checking whether the C compiler works... configure: error: cannot run C ?

BooCocky

  • Leader
  • Hero Member
  • *****
  • Posts: 875
  • Reputation: 81
  • All your base are belong to ininjas
  • Badges:
  • Computers: Dell Inspirion
  • iDevices: ipod shuffle
Re: Need to disable codesign
« Reply #3 on: October 25, 2011, 04:31:33 pm »
Yea I was able to get past that part of the configure script by deleting like 20 lines of code.  Just another thing thats a pain in the ass ya know.

A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4016
  • Reputation: 216
  • Badges:
Re: Need to disable codesign
« Reply #4 on: October 25, 2011, 04:58:12 pm »
Yeah

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

h4ck3rpr0n3

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
  • Reputation: 130
  • Developer, Genius :P :P
  • Badges:
  • Computers: HP Pavillion g7: Windows 7, BT5 R1, Ubuntu 12.04, Windows 8, Linux Mint
  • iDevices: ipod touch 3g, ipod touch 2g
Re: Need to disable codesign
« Reply #5 on: October 25, 2011, 07:47:05 pm »
hmm... but once we got around it if we package it like that then we're golden right? so it'd be a one time pain in the ass instead of repeating.
goals:
[] get developer status
[X] get 30+ karma
[X] get to hero member
[X] become part of the staff

languages i know:
JavaScript
CSS
HTML
PHP
C
C++
Cython
Python

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: Need to disable codesign
« Reply #6 on: October 25, 2011, 07:53:05 pm »
Could we write a script to move/replace gcc that would pass all the args to gcc, but then codesign the output with ldid?  

A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4016
  • Reputation: 216
  • Badges:
Re: Need to disable codesign
« Reply #7 on: October 25, 2011, 08:00:17 pm »
Or we could make our own version of make >:D

h4ck3rpr0n3

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
  • Reputation: 130
  • Developer, Genius :P :P
  • Badges:
  • Computers: HP Pavillion g7: Windows 7, BT5 R1, Ubuntu 12.04, Windows 8, Linux Mint
  • iDevices: ipod touch 3g, ipod touch 2g
Re: Need to disable codesign
« Reply #8 on: October 25, 2011, 09:09:57 pm »
Or we could make our own version of make >:D
yes we could, but wouldn't that be more work than it's worth?
goals:
[] get developer status
[X] get 30+ karma
[X] get to hero member
[X] become part of the staff

languages i know:
JavaScript
CSS
HTML
PHP
C
C++
Cython
Python

BooCocky

  • Leader
  • Hero Member
  • *****
  • Posts: 875
  • Reputation: 81
  • All your base are belong to ininjas
  • Badges:
  • Computers: Dell Inspirion
  • iDevices: ipod shuffle
Re: Need to disable codesign
« Reply #9 on: October 26, 2011, 05:15:54 am »
Every package source uses different CC flags so you can do that :P.  You have to either find the flags in the configure script and add ldid, or delete the part of the script that trys to run a test program.  

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

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: Need to disable codesign
« Reply #10 on: October 26, 2011, 09:30:39 am »
Code: [Select]
checking for C compiler default output file name... a.out
I think we could use logic similar to this part of the configure script to detect any gcc output.  Then it would be as simple as writing a new script that we would call gcc.  The code would be something like:
Code: [Select]
#!/bin/bash
gcc $*
<Logic to detect output>
ldid -S output
idk, I think ir would work unless I'm missing something.  

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: Need to disable codesign
« Reply #11 on: October 26, 2011, 03:31:02 pm »
Python FTW!!!!


#!/usr/bin/env python
import os, sys
os.system("realgcc " + " ".join(sys.argv[1:]))
for i in range(0,len(sys.argv)-1):
    if sys.argv == "-o":
        output = sys.argv[i+1]
        break
if not output:
    output = "a.out"

os.system("ldid -S %s" % output)
« Last Edit: October 26, 2011, 03:32:06 pm by C0deH4cker »

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: Need to disable codesign
« Reply #12 on: October 26, 2011, 04:10:29 pm »
Ya, would something like that work?

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: Need to disable codesign
« Reply #13 on: October 26, 2011, 08:43:24 pm »
Think so. Havent tested, but it should work.

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: Need to disable codesign
« Reply #14 on: June 01, 2012, 04:13:42 am »
No, it doesn't work due a python parse error in "-o". I don't know python, so I can only report the error.
0xEB        0xFE
jmp short -2