todica-gheorghe / iphone-dev

Automatically exported from code.google.com/p/iphone-dev
0 stars 0 forks source link

libc.dylib load command 7 unknown cmd field #141

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compiling the toolchain against the iPhone/iTouch 2.0 firmware

What is the expected output? What do you see instead?
A successful compilation of LLVM-GCC is expected.  Instead it fails giving
a "libc.dylib load command 7 unknown cmd field" error.

What version of the product are you using? On what operating system?
Running Ubuntu, compiling against iPhone 2.0.

Please provide any additional information below.
After looking around it seems to be caused by the version of the MacOSX SDK.  

Command 7 in libc.dylib is 
Load command 7
      cmd ?(0x0000001e) Unknown load command
  cmdsize 16
000233e8 0000014c

this corresponds to 'LC_SEGMENT_SPLIT_INFO' which is not in the 10.4u
version of 'mach-o/loader.h' but is in the 10.5 version.

I attempted to compile against the MaxOSX10.5 SDK and received errors about
missing headers.

I guess my questions are
1. Is it possible to compile against 10.5 (with firmware 2.0)? Or
2. Is there a work around for the missing load command?

Original issue reported on code.google.com by max.e.st...@gmail.com on 29 May 2008 at 3:51

GoogleCodeExporter commented 8 years ago
Well, it looks like my current issues with compiling against 10.5 are due to a
similar issue I had with 10.4u - bad symlinks!  Once I've got this sorted 
fingers
crossed it'll be sweet.

Original comment by max.e.st...@gmail.com on 30 May 2008 at 10:29

GoogleCodeExporter commented 8 years ago
I got to the same point...
Did you get to compile the odcctools against MacOSX10.5.sdk successfully?

Original comment by cur...@adminsparadise.com on 2 Jul 2008 at 8:02

GoogleCodeExporter commented 8 years ago
I've only just managed to test it out and unfortunately have had no luck.

After a bit of a Google on compiling the toolchain for the iPhone 2.0 OS I 
found a
guide for doing it on Leopard
(http://wikee.iphwn.org/howto:toolchain_on_leopard_aspen).  Although I'm running
Ubuntu (and this guide doesn't get it compiling for me for other reasons than 
the
above - http://code.google.com/p/iphone-dev/issues/detail?id=145) this makes me 
think
I'm on the wrong track with MacOSX 10.5.

Original comment by max.e.st...@gmail.com on 11 Jul 2008 at 9:26

GoogleCodeExporter commented 8 years ago
does anybody has a fix for this issue?

Original comment by nielsmou...@gmail.com on 6 Aug 2008 at 3:10

GoogleCodeExporter commented 8 years ago
Yeah - compiling against 10.5 is a bad idea!  What you actually need to do is 
switch
to the iPhone 2.0 branches of odcctools and the includes folder - see the 
previously
mentioned tutorial for exactly what to do.

Original comment by max.e.st...@gmail.com on 8 Aug 2008 at 10:29

GoogleCodeExporter commented 8 years ago
I experienced the same issue. How should I do?

Original comment by rogerlee...@hotmail.com on 12 Aug 2008 at 7:19

GoogleCodeExporter commented 8 years ago
Yea I'm getting the same error, and I'm not seeing a fix in any of the 
previously
mentioned tutorials.  I'm on Leopard with iPhone-OS 2.0.0.

Original comment by devi...@gmail.com on 24 Aug 2008 at 4:22

GoogleCodeExporter commented 8 years ago
You should be able to follow the previously mentioned tutorial with no trouble 
as
it's directed at Leopard users.  You will continue to get the issue if you 
compile
against 10.5 - follow the tutorial and use 10.4u.

Original comment by max.e.st...@gmail.com on 24 Aug 2008 at 7:39

GoogleCodeExporter commented 8 years ago
still doesn't work.

Original comment by devi...@gmail.com on 27 Aug 2008 at 11:58

GoogleCodeExporter commented 8 years ago
If you've followed that tutorial and you're still getting the same error then 
I'd say
somehow the 10.5 SDK is still being referenced - sorry I can't be more help.  
Maybe
if you posted the error and the script you're running to compile the tool chain 
I
could give some more insight - I realise that the error's probably exactly the 
same
as what I had and that your script is probably a copy and paste of the 
tutorial, but
it's very easy to miss something small with these things so a second pair of 
eyes can
be helpful.

Original comment by max.e.st...@gmail.com on 28 Aug 2008 at 2:27

GoogleCodeExporter commented 8 years ago
I actually have never referenced the 10.5 sdk so I don't think that's it 
(though for 
my next iteration I'll try to temporarily relocate the 10.5 sdk).  I've tried 
lots 
of things now, and I've followed the tutorial from scratch multiple times.  
I've 
probably configured the llvm-gcc over 20 times, all with different combinations 
of 
stuff (the configure string has always been the same, but the environment 
(files, 
etc..) have been slightly changed to ensure that they are all the correct files)

One thing that I'm not sure about is the patch that you reference on the other 
thread with the lib1funcs.asm file.  I only applied this patch to the 
lib1funcs.asm 
file in the llvm-gcc-4.0-iphone/gcc/config/arm directory.  Is this the only 
place 
that I'm supposed to apply this patch?

Thanks for your constant help...

Original comment by devi...@gmail.com on 28 Aug 2008 at 6:57

GoogleCodeExporter commented 8 years ago
alright, just to update, this morning I reinstalled Xcode 3.1 to make sure that 
my
MacOSX10.4u.sdk wasn't installed improperly.  I started over from scratch again 
and
applied the patch - still getting the same error.

Original comment by devi...@gmail.com on 28 Aug 2008 at 5:48

GoogleCodeExporter commented 8 years ago
Another Update:

I've had apparent success after doing the following:

uninstalled iphone-sdk

reinstalled iphone-sdk

redecrypting the iphone filesystem using vfdecrypt and the iphoneOS 2.0 for the 
3g iphone

applying the patch listed in thread 145

completing the entire toolchain tutorial from step 0.

I think that out of all of these things, the one that really made the 
difference was
decrypting the filesystem with vfdecrypt instead of using pwnagetool.  Also, 
this is
the iphone3g version of OS2.0 instead of the iphone2g version of OS2.0

I haven't actually been able to build anything with the toolchain yet though. 
Anybody know where i can get a correct xcode project template for this 
toolchain? 
I'm new to xcode. (surprise)  

Original comment by devi...@gmail.com on 28 Aug 2008 at 9:33

GoogleCodeExporter commented 8 years ago
Glad to hear you managed to sort it out.  I can't help you with xcode - I use 
Eclipse
through Ubuntu!

Original comment by max.e.st...@gmail.com on 29 Aug 2008 at 2:31

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Ok. I was successful in building on both 64 bit and 32 bit systems with the
MacOSX10.5.sdk and MacOSX10.4u.sdk

Here is what you need to do:
1. Once you have checked out the iphone-dev  trunk repository using svn do the 
following:
$ pushd include

$ svn switch http://iphone-dev.googlecode.com/svn/branches/include-1.2-sdk

$ popd

$ pushd odcctools

$ svn switch http://iphone-dev.googlecode.com/svn/branches/odcctools-9.2-ld

$ popd

This will give you the updated odcctools and include directories that work 
correctly.

2. Once you get to the llvm-gcc-4.0-iphone compilation stage and are doing the 
make,
then you will see errors if you use MacOSX10.5.sdk. These errors do not come up 
if
you use MacOSX10.4u.sdk. hence if you use MacOSX10.5.sdk, you need to copy the
usr/sys/cdefs.h from MacOSX10.5.sdk and copy it as
/usr/local/arm-apple/darwin/include/sys/cdefs.h .

3. Next step is to patch lib1funcs.asm using the patch file lib1funcs.asm.diff
provided in issue 145, and patch the 
llvm-gcc-4.0-iphone/gcc/config/arm/lib1funcs.asm
file using the command
patch -p0 < lib1funcs.asm.diff

4. Then run the make command again and everything should build perfectly.

Original comment by walb...@gmail.com on 17 Sep 2008 at 3:06

GoogleCodeExporter commented 8 years ago
I'm getting the "load command 7" error as well, trying to compile in Fedora.

If I do the above svn switches, I get the following while compiling odcctools:

In file included from ../../../odcctools/include/foreign/objc/Protocol.h:31,
                 from ../../../odcctools/otool/print_objc.c:34:
../../../odcctools/include/foreign/objc/Object.h:52: error: stray '@' in program
../../../odcctools/include/foreign/objc/Object.h:52: error: expected '=', ',', 
';',
'asm' or '__attribute__' before 'Object'
../../../odcctools/include/foreign/objc/Object.h:59: error: expected identifier 
or
'(' before '+' token
../../../odcctools/include/foreign/objc/Object.h:60: error: expected identifier 
or
'(' before '-' token
../../../odcctools/include/foreign/objc/Object.h:64: error: expected identifier 
or
'(' before '+' token
../../../odcctools/include/foreign/objc/Object.h:65: error: expected identifier 
or
'(' before '+' token
../../../odcctools/include/foreign/objc/Object.h:66: error: expected identifier 
or
'(' before '-' token
../../../odcctools/include/foreign/objc/Object.h:67: error: expected identifier 
or
'(' before '+' token
../../../odcctools/include/foreign/objc/Object.h:68: error: expected identifier 
or
'(' before '-' token

(... plus lots more of similar messages, and very similar messages for
odcctools/include/foreign/objc/Protocol.h and odcctools/otool/print_objc.c)

Original comment by wmdop...@gmail.com on 18 Sep 2008 at 1:42

GoogleCodeExporter commented 8 years ago
Sorry, ignore that last.. it looks like I didn't have gcc-objc installed.  After
installing it, walburn's changes to the install directions let me do a full 
compile
and install.

Original comment by wmdop...@gmail.com on 18 Sep 2008 at 4:05

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
To: max.e.stewart
Can you please post some instructions on how to use eclipse for iphone-dev. I'm
installing the toolchain on winXP with cygwin and I'd love to be able to use 
eclipse
for development. Thx.

Original comment by azizuy...@gmail.com on 22 Oct 2008 at 9:27

GoogleCodeExporter commented 8 years ago
2wmdopple. How can I install gcc-objc correctly? I've installed libobjc2 and 
still
got errors likev in comment 17. 

Original comment by dee...@gmail.com on 13 Nov 2008 at 10:36

GoogleCodeExporter commented 8 years ago
To: deeSun
You should be able to (depending on your platform) run 'sudo apt-get install 
gobjc' 
to setup gcc-objc.  Not too sure about Windows.

Original comment by max.e.st...@gmail.com on 13 Nov 2008 at 8:24

GoogleCodeExporter commented 8 years ago
To: azizuysal
I was running Eclipse through Ubuntu so it may have been slightly easier for 
me.  All 
I had to do was create a new "Managed make" project in Eclipse and then modify 
the 
Makefile so it called the correct gcc.  Eclipse automatically handled parsing 
the 
compiler output and reporting back.
I'm not sure how you'd do this in Windows using cygwin - you may be able to do 
it the 
same way provided the compiler is on your path.

Original comment by max.e.st...@gmail.com on 13 Nov 2008 at 8:27