Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile with Clang #30

Open
spotlightishere opened this issue Apr 20, 2015 · 35 comments
Open

Can't compile with Clang #30

spotlightishere opened this issue Apr 20, 2015 · 35 comments

Comments

@spotlightishere
Copy link

Since my gcc toolchain does not work, I have to use clang.

It does not allow the '-mthumb-interwork' option to be used, and errors out.

Will support for clang be added, or should I go find another gcc toolchain?

@nickpack
Copy link
Member

@awesomebing1 The project itself has been dead for a few years now, I doubt anyone will pick it up to be honest, but you never know :)

@spotlightishere
Copy link
Author

It is? Didn't know that.

According to Google, thumb interworking is enabled by default. So, I removed that option. Now, it fails at -Ttext=0x0. Don't know what that flag is for, could you please tell me?

@joshumax
Copy link

Someone should really pick up this project; I still use iDroid on my iPhone 3G... but as to your original question, @awesomebing1, what version of clang/llvm are you using? Why doesn't your gcc toolchain work? I managed to get this compiled from source using the iphone-dev toolchain a while back, did you try that?

@spotlightishere
Copy link
Author

I'm using clang 3.6. My gcc toolchain seems to work, but doesn't. It's the one from iDroid-Project/OpeniBoot-toolchain . I truly don't know why it doesn't work, all I know is if you copy an executable over to the device and run it, it gives the annoying "bash: cannot execute binary file" thing. I opened an issue over on that repo, but no replies.

@spotlightishere
Copy link
Author

Also, I'm on Linux (Debian 7) with a PowerPC processor. The PowerPC part may be why the toolchain isn't working, who knows :/

@joshumax
Copy link

@awesomebing1 Why are you trying to run the binary inside of iOS? IIRC it runs directly on bare metal via a bootrom exploit...

@spotlightishere
Copy link
Author

Yes, but what I mean is that my compiler doesn't compile right. It compiles, but I can't run the programs on ARM devices (my iPhone 3GS). That was just a demonstration, since I first figured that it may not work after the reboot after uploading.

@joshumax
Copy link

@awesomebing1 Ah, I see what you mean: I'll take a look and see if I can get a binary to compile right on my x86 Debian machine

@spotlightishere
Copy link
Author

I need to temporarily leave due to bad weather. I will be back.

Sent from my iPad

On Fri, Apr 24, 2015 at 6:11 PM, Josh Max [email protected]
wrote:

@awesomebing1 Ah, I see what you mean: I'll take a look and see if I can get a binarty to compile right on my x86 Debian machine

Reply to this email directly or view it on GitHub:
#30 (comment)

@joshumax
Copy link

@awesomebing1 You aren't by any chance using arm-elf-gcc from the toolchain to try to compile iOS binaries, are you? I don't think iOS accepts ARM ELF binaries; only Mach-O ones.

@joshumax
Copy link

My toolchain build does seem to work correctly (just checked the arm-elf-objdump output of some quick hello world code) but it's definitely the wrong toolchain to be using if you want to build userspace binaries for iOS...

@spotlightishere
Copy link
Author

I compiled it with that toolchain, and when it rebooted in both recovery and DFU mode I figured it was broke, and build that. So I've solved the iOS part with the GCC toolchain, but what about it rebooting? I compiled the toolchain, and immediately compiled openiBoot with scons iPhone3GS. Then, I used loadibec to upload the .bin file, and it rebooted.

@joshumax
Copy link

@awesomebing1 The iPhone 3GS isn't currently supported yet and is still very much a WIP, so there could be a number of things going wrong with it. First, is your 3GS bootrom 359.3 or 359.3.2?

@spotlightishere
Copy link
Author

The old boot rom, so I would guess the first one.

Sent from my iPad

On Fri, Apr 24, 2015 at 6:53 PM, Josh Max [email protected]
wrote:

@awesomebing1 You aren't by any chance using arm-elf-gcc from the toolchain to try to compile iOS binaries, are you? I don't think iOS accepts ARM ELF binaries; only Mach-O ones.

Reply to this email directly or view it on GitHub:
#30 (comment)

@joshumax
Copy link

@awesomebing1 Are you using loadibec from the Chronic-Dev syringe repository?

@spotlightishere
Copy link
Author

Nope, the one you guys have under your organization.

Sent from my iPad

On Fri, Apr 24, 2015 at 7:09 PM, Josh Max [email protected]
wrote:

@awesomebing1 Are you using loadibec from the Chronic-Dev syringe repository?

Reply to this email directly or view it on GitHub:
#30 (comment)

@spotlightishere
Copy link
Author

I'm going to rebuild the toolchain, haven't tried that yet

Sent from my iPad

On Fri, Apr 24, 2015 at 7:09 PM, Josh Max [email protected]
wrote:

@awesomebing1 Are you using loadibec from the Chronic-Dev syringe repository?

Reply to this email directly or view it on GitHub:
#30 (comment)

@joshumax
Copy link

loadibec might also require you to build an img3, I'm not sure though...

(I should also note that I have no affiliation with this project other than a couple days of messing around with the OpeniBoot source.)

@spotlightishere
Copy link
Author

I misunderstood. I am using the chromic-dev syringe loadibec. Perhaps that would be the problem?

@joshumax
Copy link

@awesomebing1 Try the loadibec from the iDroid OiBC repository instead and see if that fixes anything...

Edit: I'm almost certain that loadibec is going to need an img3 image rather than a raw image to work properly.

@spotlightishere
Copy link
Author

Well, that worked, sorta... it just exits with no info (seems to be a known issue)

@joshumax
Copy link

Does OpeniBoot work on your 3GS now?

@spotlightishere
Copy link
Author

I take that back. There is no img3 file. In issue #29, Bluerise said the following:
loadibec/syringe is from here -> https://github.com/Chronic-Dev/syringe
oibc -> https://github.com/iDroid-Project/OiBC

So should I switch back to the Chronic-Dev one? I'm so confused :/

@spotlightishere
Copy link
Author

No, sadly, it does not.

@spotlightishere
Copy link
Author

It tells me it "uploads succesfully" and does nothing. I get the felling this is a linux only problem, I need to try on a Mac. I'll work on this later.

@spotlightishere
Copy link
Author

It outputs the following when in DFU mode:
~/openiBoot/utils/syringe$ sudo ./utilities/loadibec ../../openiBoot/iphone_3gs_openiboot.bin
Loadibec 2.00.
Connecting to iDevice...
linera1n compatible device detected, injecting limera1n.
Initializing libpois0n
opening device 05ac:1227...
Checking if device is compatible with this jailbreak
Checking the device type
Identified device as iPhone2,1
Preparing to upload limera1n exploit
Resetting device counters
Sending chunk headers
Sending exploit payload
Sending fake data
Exploit sent
Reconnecting to device
Waiting 2 seconds for the device to pop up...
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Connection failed. Waiting 1 sec before retry.
Command completed successfully
Unable to reconnect
Unable to upload exploit data
limera1ned, reconnecting...

But meanwhile, on the device, it's booting back into iOS. I truely don't know.

@joshumax
Copy link

@awesomebing1 Are you sure you're passing an img3 into loadibec rather than a bin?

https://github.com/iDroid-Project/OiBC/blob/master/loadibec.c#L126

@spotlightishere
Copy link
Author

I'm uploading a bin since there is no img3 file.

@spotlightishere
Copy link
Author

Okay, I see that arm-elf-objdump gives the following error for the .bin file:

arm-elf-objdump: ../../openiBoot/iphone_3gs_openiboot.bin: File format not recognized

Whereas arm-elf-objdump: ../../openiBoot/iphone_3gs_openiboot gives off a bunch of assembly. Perhaps the .bin file is corrupted?

@joshumax
Copy link

@awesomebing1 Another day...and fresh eyes to look at the problem.

Taking a look at the mk8900image source shows me that scons generates two files, iphone_3gs_openiboot (the raw binary) and iphone_3gs_openiboot.bin (an img3 with a ".bin" extension). So the above commands do seem to be showing what I'd expect...

However, I believe you stated that you were attempting to compile this with a PowerPC machine? Looking at this conditional (https://github.com/iDroid-Project/openiBoot/blob/master/mk8900image/SConscript#L10) in the mk8900image SConstruct shows that if the architecture isn't x86_64 (presumably AMD64), it's automatically assumed to be x86 and links with precompiled libs of the wrong architecture? (Correct me if I'm wrong.)

What happens if you try to boot your iPhone into DFU mode and flash the raw binary (the non-.bin one)? Does that work instead?

@spotlightishere
Copy link
Author

It does, and that's why I compiled xpwn myself and copied libcommon.a and libxpwn.a over, so it would compile.

I tried doing the raw binary, and got the same response with the Chronic-Dev syringe. I looked over at that repo, and found that there's a bug. Joshua Hill reccomended to go to openjailbreak.com and grab the version there, so I'll try that.

Thank you for attempting to help me!

Sent from my iPad

On Sat, Apr 25, 2015 at 2:44 PM, Josh Max [email protected]
wrote:

@awesomebing1 Another day...and fresh eyes to look at the problem.
Taking a look at the mk8900image source shows me that scons generates two files, iphone_3gs_openiboot (the raw binary) and iphone_3gs_openiboot.bin (an img3 with a ".bin" extension). So the above commands do seem to be showing what I'd expect...
However, I believe you stated that you were attempting to compile this with a PowerPC machine? Looking at this conditional (https://github.com/iDroid-Project/openiBoot/blob/master/mk8900image/SConscript#L10) in the mk8900image SConstruct shows that if the architecture isn't (x86_64 (presumably AMD64)), it's automatically assumed to be x86 and links with precompiled libs of the wrong architecture? (Correct me if I'm wrong.)

What happens if you try to boot your iPhone into DFU mode and flash the raw binary (the non-.bin one)? Does that work instead?

Reply to this email directly or view it on GitHub:
#30 (comment)

@joshumax
Copy link

@awesomebing1 Sure thing... I hope that works!

@nickpack
Copy link
Member

@joshumax You are correct, we never envisaged it being built on a powerpc platform :)

@spotlightishere
Copy link
Author

This must be a PowerPC issue, as I compiled it on a Mac running Linux and it successfully uploaded. Though it did not install (should I open a new issue?).

@nickpack
Copy link
Member

Yeah, probably wise to open a new issue, if I can help I will. Not sure any bugs will actually get fixed though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants