p2 / Redland-ObjC

Objective-C wrapper for the Redland RDF libraries
Other
20 stars 11 forks source link

cross-compile.py cannot pick up libxslt.dylib for armv7 architecture #5

Closed mrcroc closed 11 years ago

mrcroc commented 11 years ago

This is a follow-up issue to #4.

The compilation now fails because it apparently tries to pick up e.g. libxml2.dylib from a wrong location. Here's the peraps relevant excerpt of cross-compile.py's output:

-> libxml2-sources-2.7.8.tar.gz --> Downloading libxml2-sources-2.7.8.tar.gz (3472 KB) 3472005 [100.00%]

--> iOS: armv7 ---> Unpacking downloads/libxml2-sources-2.7.8.tar.gz ---> Configuring build-iOS-armv7/libxml2-2.7.8 ---> Building build-iOS-armv7/libxml2-2.7.8 ---> Installing build-iOS-armv7/libxml2-2.7.8

/bin/sh ../libtool --tag=CC --mode=link /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -std=c99 -arch armv7 -pipe --sysroot='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk' -isysroot '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk' -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/include -I/PATH_WITHOUT_SPACES/Redland-ObjC/Redland-source/product-iOS-armv7/include --sysroot='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk' -isysroot='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk' -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib -L/PATH_WITHOUT_SPACES/Redland-ObjC/Redland-source/product-iOS-armv7/lib -o rapper rapper.o ../src/libraptor2.la libtool: link: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -std=c99 -arch armv7 -pipe --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/include -I/PATH_WITHOUT_SPACES/Redland-ObjC/Redland-source/product-iOS-armv7/include --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -isysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -o rapper rapper.o -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib -L/PATH_WITHOUT_SPACES/Redland-ObjC/Redland-source/product-iOS-armv7/lib ../src/.libs/libraptor2.a -L/opt/local/lib /opt/local/lib/libxslt.dylib /opt/local/lib/libxml2.dylib /opt/local/lib/liblzma.dylib -lz -lpthread /opt/local/lib/libiconv.dylib -lm -pthread ld: warning: ignoring file /opt/local/lib/libxslt.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7): /opt/local/lib/libxslt.dylib ld: warning: ignoring file /opt/local/lib/libxml2.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7): /opt/local/lib/libxml2.dylib ld: warning: ignoring file /opt/local/lib/liblzma.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7): /opt/local/lib/liblzma.dylib ld: warning: ignoring file /opt/local/lib/libiconv.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7): /opt/local/lib/libiconv.dylib Undefined symbols for architecture armv7:

"_htmlCreatePushParserCtxt", referenced from: _raptor_grddl_parse_chunk in libraptor2.a(raptor_grddl.o) "_htmlCtxtUseOptions", referenced from: _raptor_grddl_parse_chunk in libraptor2.a(raptor_grddl.o) "_htmlFreeParserCtxt", referenced from: _raptor_grddl_parse_terminate in libraptor2.a(raptor_grddl.o) _raptor_grddl_parse_chunk in libraptor2.a(raptor_grddl.o) "_htmlParseChunk", referenced from: _raptor_grddl_parse_chunk in libraptor2.a(raptor_grddl.o) "_xmlAddChildList", referenced from: _raptor_libxml_getEntity in libraptor2.a(raptor_libxml.o) "_xmlCleanupParser", referenced from: _raptor_libxml_finish in libraptor2.a(raptor_libxml.o) "_xmlCreatePushParserCtxt", referenced from: _raptor_grddl_uri_xml_parse_bytes in libraptor2.a(raptor_grddl.o) _raptor_grddl_parse_chunk in libraptor2.a(raptor_grddl.o) _raptor_sax2_parse_chunk in libraptor2.a(raptor_sax2.o)

ld: symbol(s) not found for architecture armv7 collect2: ld returned 1 exit status make[1]: * [rapper] Error 1 make: * [all-recursive] Error 1

I am wondering: why is ld not instructed to pick up libxml2.dylib from where it was placed by the previous compile step and where that would be. At /opt/local/lib/libxml2.dylib is apparently an older version (perhaps part of OS X or installed by MacPorts) for the x86_64 (not armv7) architecture.

BTW, if I run _cd /PATH_WITHOUTSPACES; find . -name lib''.dylib* I get this (i.e. neither libxml2.dylib nor one of the other three libraries exists here for the armv7 architecture).

./Redland-source/build-Mac-i386/libxml2-2.7.8/.libs/libxml2.2.dylib ./Redland-source/build-Mac-i386/libxml2-2.7.8/.libs/libxml2.2.dylib.dSYM/Contents/Resources/DWARF/libxml2.2.dylib ./Redland-source/build-Mac-i386/libxml2-2.7.8/.libs/libxml2.dylib ./Redland-source/build-Mac-i386/raptor2-2.0.9/src/.libs/libraptor2.0.dylib ./Redland-source/build-Mac-i386/raptor2-2.0.9/src/.libs/libraptor2.dylib ./Redland-source/build-Mac-x86_64/libxml2-2.7.8/.libs/libxml2.2.dylib ./Redland-source/build-Mac-x86_64/libxml2-2.7.8/.libs/libxml2.2.dylib.dSYM/Contents/Resources/DWARF/libxml2.2.dylib ./Redland-source/build-Mac-x86_64/libxml2-2.7.8/.libs/libxml2.dylib ./Redland-source/build-Mac-x86_64/raptor2-2.0.9/src/.libs/libraptor2.0.dylib ./Redland-source/build-Mac-x86_64/raptor2-2.0.9/src/.libs/libraptor2.dylib ./Redland-source/product-Mac-i386/lib/libraptor2.0.dylib ./Redland-source/product-Mac-i386/lib/libraptor2.dylib ./Redland-source/product-Mac-i386/lib/libxml2.2.dylib ./Redland-source/product-Mac-i386/lib/libxml2.dylib ./Redland-source/product-Mac-x86_64/lib/libraptor2.0.dylib ./Redland-source/product-Mac-x86_64/lib/libraptor2.dylib ./Redland-source/product-Mac-x86_64/lib/libxml2.2.dylib ./Redland-source/product-Mac-x86_64/lib/libxml2.dylib

p2 commented 11 years ago

I cannot reproduce this in a fresh checkout. If you do a checkout to a directory without spaces and run the cross compile script, does the issue persist?

cd ~/Desktop
git clone git@github.com:p2/Redland-ObjC.git
cd Redland-Objc/Redland-source
python cross-compile.py

ld is given the path where libxml was built, you can see that with all the -L and -I with /PATH_WITHOUT_SPACES/Redland-ObjC/Redland-source/product-iOS-armv7/lib in the log.

mrcroc commented 11 years ago

Thx. I've been able to overcome this finally by uninstalling MacPorts port libxml2 and hence the file /opt/local/lib/libxml2.dylib as it was owned by this port. Presence of this file/library on my OS X 10.7.5 build host had evidently "somehow" interfered with the normal build process in cross-compile.py.

sudo port uninstall --follow-dependents libxml2

p2 commented 11 years ago

Ah that makes sense. There probably is a way to have the script prefer its own path before system paths so this issue doesn't come up again. Thanks!