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

build x86 version for simulator too #9

Closed
revolunet opened this issue Jul 7, 2012 · 14 comments

Comments

Projects
None yet
10 participants
@revolunet
Copy link

commented Jul 7, 2012

Because i don't always have the physical devices to test it on, it would be great to be able to test the apps on the xcode simulator.

It shouldnt be difficult to create a separate x86 build in the builddirectory.

But i don't get any idea how these two builds should integrate into the xcode project

Can you give some pointers/warnings ?

@fictorial

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2013

I would love to see a iOS Simulator compatible version of Kivy too.

I updated the build settings of the generated XCode project (updating the script that generates the XCode project makes more sense but...):

  • Supported Platforms: iOS
  • Valid Architectures: added i386 to the list

But the libraries built are not Universal, just armv7 it seems.

ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libios.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libios.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libvorbisidec.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libvorbisidec.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libogg.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libogg.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libSDL_mixer.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libSDL_mixer.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libkivy.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libkivy.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libfreetype.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libfreetype.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libSDL_ttf.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libSDL_ttf.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libSDL2.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libSDL2.a
ld: warning: ignoring file /Users/bhammond/OpenSource/kivy-ios/build/lib/libpython2.7.a, file was built for archive which is not the architecture being linked (i386): /Users/bhammond/OpenSource/kivy-ios/build/lib/libpython2.7.a

Indeed:

kivy-ios(master) $ lipo -info build/lib/libpython2.7.a 
input file build/lib/libpython2.7.a is not a fat file
Non-fat file: build/lib/libpython2.7.a is architecture: armv7
@fictorial

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2013

So I started working on building Python for i386 in hopes of then creating a Universal / fat library for use in the iOS Simulator.

Python is building but I am stuck on this:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin11-llvm-gcc-4.2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -Lextralibs/ -lsqlite3  -o python.exe \
            Modules/python.o \
            libpython2.7.a -ldl  -framework CoreFoundation -L/Users/bhammond/Projects/kivy-ios/build/python/lib -lz                   
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/usr/local/bin/ginstall -c python.exe /Users/bhammond/Projects/kivy-ios/build/python/bin/python2.7
ImportError: No module named site
make: *** [sharedmods] Error 1
make: *** Waiting for unfinished jobs....

I am certainly not an expert on building Python from source so any help would be appreciated!

fictorial@952bffc

@tito

This comment has been minimized.

Copy link
Member

commented Feb 11, 2013

I got the same issue after trying to compile the i386 version, even with using the cross compilation approach.
We could re-look at our very initial script: https://github.com/dennda/python-for-iphone/blob/master/iOS-build.sh

@congnghebitcoin

This comment has been minimized.

Copy link

commented Sep 22, 2013

I get the same problem. Is there anyone can help me with this please...

@hansent

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2013

some progress...

just pushed iphonesimulator branch: https://github.com/kivy/kivy-ios/tree/iphonesimulator
I've e goten everythign to compile for iphonesimulator, however, am now stuck at linking libs together in Xcode at the end of build process:

ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
duplicate symbol _ffi_type_longdouble in:
    /Users/tehansen/code/kivy-ios/build/lib/libffi.a(types.o)
    /Users/tehansen/code/kivy-ios/build/lib/libpython2.7.a(cfield.o)
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

the link command used by Xcode:

Ld /Users/tehansen/Library/Developer/Xcode/DerivedData/tracer-fplkeykljnbuqvgsnxewfjuwdcfy/Build/Products/Debug-iphonesimulator/tracer.app/tracer normal i386
    cd /Users/tehansen/code/kivy-ios/app-tracer
    setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
    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/iPhoneSimulator7.0.sdk -L/Users/tehansen/Library/Developer/Xcode/DerivedData/tracer-fplkeykljnbuqvgsnxewfjuwdcfy/Build/Products/Debug-iphonesimulator -L/Users/tehansen/code/kivy-ios/app-tracer/../build/lib -F/Users/tehansen/Library/Developer/Xcode/DerivedData/tracer-fplkeykljnbuqvgsnxewfjuwdcfy/Build/Products/Debug-iphonesimulator -filelist /Users/tehansen/Library/Developer/Xcode/DerivedData/tracer-fplkeykljnbuqvgsnxewfjuwdcfy/Build/Intermediates/tracer.build/Debug-iphonesimulator/tracer.build/Objects-normal/i386/tracer.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -all_load -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework CoreMotion -lffi -lpyobjus -lsqlite3 -framework MessageUI -lios -lvorbisidec -logg -lSDL_mixer -lfreetype -lkivy -lpython2.7 -lSDL_ttf -lSDL2 -lbz2 -lz -framework ImageIO -framework Foundation -framework UIKit -framework CoreGraphics -framework OpenGLES -framework AudioToolbox -framework QuartzCore -Xlinker -dependency_info -Xlinker /Users/tehansen/Library/Developer/Xcode/DerivedData/tracer-fplkeykljnbuqvgsnxewfjuwdcfy/Build/Intermediates/tracer.build/Debug-iphonesimulator/tracer.build/Objects-normal/i386/tracer_dependency_info.dat -o /Users/tehansen/Library/Developer/Xcode/DerivedData/tracer-fplkeykljnbuqvgsnxewfjuwdcfy/Build/Products/Debug-iphonesimulator/tracer.app/tracer
@hansent

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2013

got it workin:

d6919ca

made changes to the build scripts in order to compile using iphonesimulator platform and arch i386.

tools/compile-all.sh
tools/create-xcode-project.sh tracer ~/code/kivy/examples/demo/touchtracer/

#had to do it manually, because at least on  my machine it failed to compile main.py to main.pyo...
# see details below
tools/populate-project.sh tracer ~/code/kivy/examples/demo/touchtracer/ 

open Xcode, adjust following project settings:

  • Build Settings -> "Supported Platforms" should be "iOS" instead of "iphoneos"
  • General -> Deployment Info -> Device should be "iPhone" instead of "iPad"

run the simulator....works!

populate-project problem

I also had to change main.m to load main.py instead of main.pyo, and edit the populate-project script.
for some reason, the script failed when doing the compie all step as part of the build process. see output here: https://gist.github.com/hansent/7189082

there is still a main.pyo created, but when I run the project, the simulator starts, quits right away with error:

2013-10-27 18:13:30.190 tracer[14111:70b] Running main.pyo: (null)
2013-10-27 18:13:30.190 tracer[14111:70b] Unable to open main.pyo, abort.

not sure whats going on here yet...maybe i screwed up the host-python build somehow?

@hansent

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2013

Actually, just leaving build setting on iPad, and using iPad simulator seems to work fine too :)

Now to figure out a good way to integrate doing the native and simulator build:

  • I think all we have to do to switch between the two right now is adjust to ENV variables in environment.sh
    • TARGET_SDK should be either iphoneos or iphonesimulator
    • CPU_ARCHITECHTURE should be either armv7 or i386 depending on TARGET_SDK (so we can do an if in thw script)
  • do we want a fat static lib linked that can just do both?
@atanudey

This comment has been minimized.

Copy link

commented Nov 4, 2013

Hi hansent,

I took the branch "iphonesimulator" code. The build was successful. When I'm running the Xcode project I'm getting following errors -

Undefined symbols for architecture i386:
"_PyEval_InitThreads", referenced from:
_SDL_main in main.o
"_PyRun_SimpleFileExFlags", referenced from:
_SDL_main in main.o
"_PyRun_SimpleStringFlags", referenced from:
_load_custom_builtin_importer in main.o
"_PySys_SetArgv", referenced from:
_SDL_main in main.o
"_Py_Finalize", referenced from:
_SDL_main in main.o
"_Py_Initialize", referenced from:
_SDL_main in main.o
"_Py_SetPythonHome", referenced from:
_SDL_main in main.o
"_main", referenced from:
start in crt1.o
(maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

In my build settings I set following -

Build Settings -> "Supported Platforms" should be "iOS" instead of "iphoneos"
General -> Deployment Info -> Device should be "iPhone" instead of "iPad"

I'm using -

Xcode5
OS X 10.9
iPhone Simulator 6.1/7.0

Is the code ready for i386 based MAC OSX iPhone simulator? Or I'm doing something wrong?

Thanks

@cropleyb

This comment has been minimized.

Copy link

commented Jan 8, 2014

I tried this too. It created the project OK, but it took me ages to find the Build Settings -> "Supported Platforms"
It turned out that I needed to click on the project at the top of the left panel. (I'm an XCode newby)

I haven't found 'General -> Deployment Info -> Device should be "iPhone" instead of "iPad"'
(I'm using XCode 4.6.3)

When I try to run it, I get (twice) "File /Users/cropleyb/Library/Developer/Xcode/DerivedData/tracer-gbmewstiiygtnyeuyuwmqyrgbbxt/Build/Products/Debug-iphonesimulator/tracer.app depends on itself. This target might include its own product."

@cropleyb

This comment has been minimized.

Copy link

commented Jan 8, 2014

To get around "This target might include its own product.", I followed the advice at http://stackoverflow.com/questions/7970794/how-to-fix-xcode-4-error-app-depends-on-itself-this-target-might-include-its-o and deleted the product. Now I'm hitting the same problem as atanudey above.
Thanks :)

@breakbad

This comment has been minimized.

Copy link

commented Feb 5, 2014

Same issue as previous two users. Has a cause for this been found? (osx 10.9.1, Xcode 5.0.2)

@hanattaw

This comment has been minimized.

Copy link

commented Dec 21, 2014

Same issue as @atanudey on OS X 10.10.1 and Xcode 6.0

@undefiened

This comment has been minimized.

Copy link

commented Jan 11, 2015

Same issue as @hanattaw, @atanudey xCode6.1.1, OSX 10.10.1

@tito

This comment has been minimized.

Copy link
Member

commented Mar 4, 2015

Works with the new toolchain commited on master. armv7, arm86, i386 and x86_64 are supported!

@tito tito closed this Mar 4, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.