Linker problem with build for iOS simulator
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Linker problem with build for iOS simulator
I am trying to port over an existing Ogre project to iOS and I'm just building it for the simulator to get things started. Also, I'm using the Ogre 1.7.4 prebuilt SDK for iPhone.
Before trying to port this project, I managed to get the XCode Ogre template project working in the simulator and used those build settings as a starting point for the port.
Now, I'm stuck on this particular linker error:
Ld "/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator/3DPong iPhone Sim.app/3DPong iPhone Sim" normal i386
cd /Users/daedalic/Development/IOS/3DPong
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator -L/Users/daedalic/Development/SDKs/OgreSDK/lib/Release -L/Users/daedalic/Development/SDKs/OgreSDK/iPhoneDependencies/lib/Release -L/Users/daedalic/Development/SDKs/OgreSDK/iPhoneDependencies/lib -F/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator -F/Users/daedalic/Development/IOS/3DPong/../../SDKs/bullet-2.80-rev2531/src/LinearMath -F/Users/daedalic/Development/IOS/3DPong/../../SDKs/bullet-2.80-rev2531/src/BulletCollision -F/Users/daedalic/Development/IOS/3DPong/../../SDKs/bullet-2.80-rev2531/src/BulletDynamics -filelist "/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Intermediates/3DPong.build/Debug-iphonesimulator/3DPong iPhone Sim.build/Objects-normal/i386/3DPong iPhone Sim.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -lOIS -lOgreMainStatic -lRenderSystem_GLESStatic -lboost_thread -lFreeType -lFreeImage -lzzip -lz -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework LinearMath -framework BulletCollision -framework BulletDynamics -o "/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator/3DPong iPhone Sim.app/3DPong iPhone Sim"
Undefined symbols for architecture i386:
"_ft_strncmp", referenced from:
_main in libFreeType.a(gxvfgen.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Seems at first glance that some of the static libs in the Ogre iPhone SDK might not work for the simulator, but then again it worked just fine in the template project. Any help would be much appreciated. Thanks!
Before trying to port this project, I managed to get the XCode Ogre template project working in the simulator and used those build settings as a starting point for the port.
Now, I'm stuck on this particular linker error:
Ld "/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator/3DPong iPhone Sim.app/3DPong iPhone Sim" normal i386
cd /Users/daedalic/Development/IOS/3DPong
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator -L/Users/daedalic/Development/SDKs/OgreSDK/lib/Release -L/Users/daedalic/Development/SDKs/OgreSDK/iPhoneDependencies/lib/Release -L/Users/daedalic/Development/SDKs/OgreSDK/iPhoneDependencies/lib -F/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator -F/Users/daedalic/Development/IOS/3DPong/../../SDKs/bullet-2.80-rev2531/src/LinearMath -F/Users/daedalic/Development/IOS/3DPong/../../SDKs/bullet-2.80-rev2531/src/BulletCollision -F/Users/daedalic/Development/IOS/3DPong/../../SDKs/bullet-2.80-rev2531/src/BulletDynamics -filelist "/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Intermediates/3DPong.build/Debug-iphonesimulator/3DPong iPhone Sim.build/Objects-normal/i386/3DPong iPhone Sim.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -lOIS -lOgreMainStatic -lRenderSystem_GLESStatic -lboost_thread -lFreeType -lFreeImage -lzzip -lz -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework LinearMath -framework BulletCollision -framework BulletDynamics -o "/Users/daedalic/Library/Developer/Xcode/DerivedData/3DPong-hiifndmxgrphhybjtbiuxjmicjfg/Build/Products/Debug-iphonesimulator/3DPong iPhone Sim.app/3DPong iPhone Sim"
Undefined symbols for architecture i386:
"_ft_strncmp", referenced from:
_main in libFreeType.a(gxvfgen.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Seems at first glance that some of the static libs in the Ogre iPhone SDK might not work for the simulator, but then again it worked just fine in the template project. Any help would be much appreciated. Thanks!
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Linker problem with build for iOS simulator
It looks like freetype may be compiled wrong. Are you using the lib from the dependencies package or somewhere else?
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
I have the build settings set up to look for lib files in the iPhoneDependencies folder that I downloaded and added to the Ogre SDK. So it should be finding the free type lib there.
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Linker problem with build for iOS simulator
Hmm, it's possible that there's something wrong with the lib. Would you be able to build it from the ogredeps repo? https://bitbucket.org/cabalistic/ogredeps
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
I'll give that a try in a bit.
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
Well just tried that and the freetype and ois libs would not compile when configured to use the iOS SDK. They managed to compile fine for OSX, not that its any use to me.
Edit: I'm getting unknown type name errors for freetype for the most part. CFXMLTreeRef, CGDirectDisplayID, CGCharCode, CGKeyCode, and ResourceIndex are the unknown types if that helps.
Edit: I'm getting unknown type name errors for freetype for the most part. CFXMLTreeRef, CGDirectDisplayID, CGCharCode, CGKeyCode, and ResourceIndex are the unknown types if that helps.
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Linker problem with build for iOS simulator
Could you run this in Terminal and copy the output?
Code: Select all
locate libfreetype.a
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
/Users/daedalic/Development/SDKs/OgreSDK/iPhoneDependencies/lib/Debug/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK/iPhoneDependencies/lib/Release/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK/lib/Debug/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/iPhoneDependencies/lib/Debug/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/iPhoneDependencies/lib/Release/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/lib/Debug/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/lib/Release/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-7-4/iPhoneDependencies/lib/Debug/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-7-4/iPhoneDependencies/lib/Release/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-8-0RC1/iOSDependencies/lib/Debug/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-8-0RC1/iOSDependencies/lib/Release/libFreeType.a
I have the project set by default to look under .../OgreSDK/iPhoneDependencies/lib/Release/ and .../OgreSDK/lib/Release/
The OgreSDK_iOS directory is just a copy of the same SDK under a different name.
There was originally a libFreeType.a under the OgreSDK/lib/Release/ which I had removed in an attempt to fix the problem.
/Users/daedalic/Development/SDKs/OgreSDK/iPhoneDependencies/lib/Release/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK/lib/Debug/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/iPhoneDependencies/lib/Debug/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/iPhoneDependencies/lib/Release/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/lib/Debug/libFreeType.a
/Users/daedalic/Development/SDKs/OgreSDK_iOS/lib/Release/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-7-4/iPhoneDependencies/lib/Debug/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-7-4/iPhoneDependencies/lib/Release/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-8-0RC1/iOSDependencies/lib/Debug/libFreeType.a
/Users/daedalic/Development/ogre_src_v1-8-0RC1/iOSDependencies/lib/Release/libFreeType.a
I have the project set by default to look under .../OgreSDK/iPhoneDependencies/lib/Release/ and .../OgreSDK/lib/Release/
The OgreSDK_iOS directory is just a copy of the same SDK under a different name.
There was originally a libFreeType.a under the OgreSDK/lib/Release/ which I had removed in an attempt to fix the problem.
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Linker problem with build for iOS simulator
I would try to slim down the list of link directories, see if you can figure out which of those libs is bad.
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
The bad one is definitely the lib in OgreSDK/iPhoneDependencies/Release
I removed the other libs by that name elsewhere in OgreSDK just to be sure. Only OgreSDK is being included in the project. The libs in other folders are not being included in this project.
I removed the other libs by that name elsewhere in OgreSDK just to be sure. Only OgreSDK is being included in the project. The libs in other folders are not being included in this project.
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
I tried using the 1.8 SDK on the off chance that would help and I still got the same linker error. I then tried to build those dependency libs from the latest dependency source to try to generate a working freetype lib file.
The commands I used to set up the Xcode project with cmake after pulling from the repo were
After that I tried to build the project and got this error for freetype when trying to build for the iPhoneSimulator target (or any other target for that matter):
I'm also getting the same error when trying to build the other libs as well.
Any idea of why I'm getting this error?
The commands I used to set up the Xcode project with cmake after pulling from the repo were
Code: Select all
cd ogredeps
mkdir build
cd build
cmake -DOGRE_BUILD_PLATFORM_APPLE_IOS=1 -G Xcode ..
Code: Select all
PhaseScriptExecution "CMake PostBuild Rules" build/src/freetype/OGREDEPS.build/Debug-iphonesimulator/freetype.build/Script-F2B53AFE652B4DC0AD3D4EFC.sh
cd /Users/daedalic/Development/ogredepsios/ogredeps
/bin/sh -c /Users/daedalic/Development/ogredepsios/ogredeps/build/src/freetype/OGREDEPS.build/Debug-iphonesimulator/freetype.build/Script-F2B53AFE652B4DC0AD3D4EFC.sh
lipo -create /Users/daedalic/Development/ogredepsios/ogredeps/build/src/freetype/Debug-iphoneos/libfreetype.a -arch i386 /Users/daedalic/Development/ogredepsios/ogredeps/build/src/freetype/Debug-iphonesimulator/libfreetype.a -output /Users/daedalic/Development/ogredepsios/ogredeps/build/../lib/libfreetype.a
lipo: can't open input file: /Users/daedalic/Development/ogredepsios/ogredeps/build/src/freetype/Debug-iphoneos/libfreetype.a (No such file or directory)
make: *** [freetype_buildpart_0] Error 1
Command /bin/sh failed with exit code 2
Any idea of why I'm getting this error?
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Linker problem with build for iOS simulator
I'll check on this tonight and commit a fix, I'm getting it too
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
I got the update from the repo and tried to build it. The device target builds fine for freetype, but I'm getting the same error when I try to build for the simulator.
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Linker problem with build for iOS simulator
Works here. Try reconfiguring with CMake to regenerate the Xcode project.
-
- Gnoblar
- Posts: 24
- Joined: Wed May 02, 2012 7:19 pm
Re: Linker problem with build for iOS simulator
I got everything compiling. Thanks for the help!
-
- Gnoblar
- Posts: 1
- Joined: Sun Sep 30, 2012 8:47 pm
Re: Linker problem with build for iOS simulator
How do you do that? Sorry for my basic questions. I'm just trying to figure out how to get started here. Any help would be appreciated.masterfalcon wrote:Works here. Try reconfiguring with CMake to regenerate the Xcode project.
thanks