[pyobjus] load_framework error

163 views
Skip to first unread message

pierre....@gmail.com

unread,
Oct 16, 2016, 11:18:28 AM10/16/16
to Kivy users support
Hello,

I am trying to implement a basic (as a starter) notification for iOS with pyobjus. Here follows a part of the code used (direct copy/paste from pyobjus examples):
******************************************************************************************************
from pyobjus import autoclass, objc_str
from pyobjus.dylib_manager import load_framework, INCLUDE

class PXPApp(App):
  def build(self):
      ... some code, defining ttl and msg as strings
      print 'trying to make notification:'
      print '  - title: ', ttl
      print '  - message: ', msg
      load_framework(INCLUDE.AppKit)
      # get both nsalert and nsstring class
      NSAlert = autoclass('NSAlert')
      NSString = autoclass('NSString')
      ns = lambda x: NSString.alloc().initWithUTF8String_(x)
      alert = NSAlert.alloc().init()
      alert.setMessageText_(ns('Hello world from python!'))
      alert.addButtonWithTitle_(NSString.stringWithUTF8String_("OK"))
      alert.addButtonWithTitle_(NSString.stringWithUTF8String_("Cancel"))
      alert.runModal()
******************************************************************************************************
I can't have the notification system work on simulator (for example iPhone 5) with the following error:
******************************************************************************************************
2016-10-16 17:05:59.436178 pxpapp[961:14455] bundleid: org.kivy.pxpapp, enable_level: 0, persist_level: 0, propagate_with_activity: 0
2016-10-16 17:05:59.437701 pxpapp[961:14455] subsystem: com.apple.siri, category: Intents, enable_level: 1, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.461328 pxpapp[961:14565] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-16 17:05:59.461937 pxpapp[961:14565] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-16 17:05:59.476821 pxpapp[961:14562] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.631613 pxpapp[961:14455] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-16 17:05:59.636345 pxpapp[961:14455] subsystem: com.apple.BackBoardServices.fence, category: App, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.741191 pxpapp[961:14455] subsystem: com.apple.BackBoardServices.fence, category: Workspace, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.742 pxpapp[961:14455] Available orientation: KIVY_ORIENTATION=LandscapeLeft LandscapeRight Portrait PortraitUpsideDown
2016-10-16 17:05:59.742 pxpapp[961:14455] PythonHome is: /Users/tjmaxgov/Library/Developer/CoreSimulator/Devices/A7D8BD7F-C487-4842-A57E-82A078CFFEB2/data/Containers/Bundle/Application/3519EE6C-506C-4D97-BBD7-C2295620A511/pxpapp.app
2016-10-16 17:05:59.743 pxpapp[961:14455] Initializing python
2016-10-16 17:05:59.804 pxpapp[961:14455] Running main.pyo: /Users/tjmaxgov/Library/Developer/CoreSimulator/Devices/A7D8BD7F-C487-4842-A57E-82A078CFFEB2/data/Containers/Bundle/Application/3519EE6C-506C-4D97-BBD7-C2295620A511/pxpapp.app/YourApp/main.pyo
Got dlopen error on Foundation
2016-10-16 17:06:00.300 pxpapp[961:14455] Error loading /System/Library/Frameworks/AppKit.framework/AppKit:  dlopen(/System/Library/Frameworks/AppKit.framework/AppKit, 265): no suitable image found.  Did find:
    /System/Library/Frameworks/AppKit.framework/AppKit: mach-o, but not built for iOS simulator
2016-10-16 17:06:00.302 pxpapp[961:14455] Application quit abnormally!
2016-10-16 17:06:00.316 pxpapp[961:14455] Leaving
******************************************************************************************************
Same goes if I try on a real device (iOS 9.3.5 iPhone 4):
******************************************************************************************************
2016-10-16 16:52:55.457 pxpapp[321:25807] Available orientation: KIVY_ORIENTATION=LandscapeLeft LandscapeRight Portrait PortraitUpsideDown
2016-10-16 16:52:55.475 pxpapp[321:25807] PythonHome is: /var/containers/Bundle/Application/C4C93379-B05B-4260-887A-B18F2B6AFAA9/pxpapp.app
2016-10-16 16:52:55.485 pxpapp[321:25807] Initializing python
2016-10-16 16:52:55.983 pxpapp[321:25807] Running main.pyo: /var/containers/Bundle/Application/C4C93379-B05B-4260-887A-B18F2B6AFAA9/pxpapp.app/YourApp/main.pyo
[INFO              ] [Kivy        ] v1.9.1
[INFO              ] [Python      ] v2.7.1 (r271:86832, Oct 11 2016, 14:31:22)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
[INFO              ] [Factory     ] 179 symbols loaded
[INFO              ] [Image       ] Providers: img_imageio, img_tex (img_dds, img_sdl2, img_ffpyplayer, img_pil, img_gif ignored)
Got dlopen error on Foundation
[INFO              ] [Text        ] Provider: sdl2
[INFO              ] [OSC         ] using <thread> for socket
[INFO              ] [Window      ] Provider: sdl2
[INFO              ] [GL          ] OpenGL version <OpenGL ES 2.0 IMGSGX543-124.1>
[INFO              ] [GL          ] OpenGL vendor <Imagination Technologies>
[INFO              ] [GL          ] OpenGL renderer <PowerVR SGX 543>
[INFO              ] [GL          ] OpenGL parsed version: 2, 0
[INFO              ] [GL          ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO              ] [GL          ] Texture max size <4096>
[INFO              ] [GL          ] Texture max units <8>
[INFO              ] [Window      ] auto add sdl2 input provider
[INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
trying to make notification:
  - title:  title
  - message:  last notif: 1476615859.02
 Traceback (most recent call last):
   File "/Users/tjmaxgov/Desktop/kivy-ios/pxpapp-ios/YourApp/main.py", line 851, in <module>
   File "/Users/tjmaxgov/Desktop/kivy-ios/build/kivy/i386/kivy-1.9.1/iosbuild/lib/python2.7/site-packages/kivy/app.py", line 802, in run
   File "/Users/tjmaxgov/Desktop/kivy-ios/pxpapp-ios/YourApp/main.py", line 822, in build
   File "/Users/tjmaxgov/Desktop/kivy-ios/build/pyobjus/i386/pyobjus-master/iosbuild/lib/python2.7/site-packages/pyobjus/dylib_manager.py", line 190, in load_framework
 pyobjus.pyobjus.ObjcException: Error while loading /System/Library/Frameworks/AppKit.framework framework

2016-10-16 16:52:59.162 pxpapp[321:25807] Application quit abnormally!
2016-10-16 16:52:59.257 pxpapp[321:25807] Leaving
******************************************************************************************************

I found similar topics but they never had an answer. It is highly possible my installation is not well done, here is what I have:
  - xcode 8.0 (but the same error came with 7.2) with command line tools
  - kivy-ios built with kivy, plyer, pyobjus
 
I do manage to build the simplest example:
******************************************************************************************************
NSString = autoclass('NSString')
text = NSString.alloc().initWithUTF8String_('Hello world')
print text.UTF8String()
******************************************************************************************************

So I think my setup is alright, but I won't manage to load AppKit..

Any idea ? If you need more information I can bring it (like pip list, or toolchain status...)

Thanks,
Pierre

ZenCODE

unread,
Nov 1, 2016, 3:58:33 AM11/1/16
to Kivy users support
Hi

We are hitting the same error, and it prevents any logs from appearing. When you say you can build the simplest example, are you runnign that on the Mac or the device? We can get PyObjus working no hassle on MacOS, but we just get the dlopen error when running on iOS (10. It works on 9 and 8).

Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 9): no suitable image found.


pierre....@gmail.com

unread,
Nov 1, 2016, 7:15:32 AM11/1/16
to Kivy users support

Le mardi 1 novembre 2016 08:58:33 UTC+1, ZenCODE a écrit :
Hi

We are hitting the same error, and it prevents any logs from appearing. When you say you can build the simplest example, are you runnign that on the Mac or the device?

On mac, simulator and real device the program will build and run. However on both the simulator and the real device I have the dlopen error on Foundation but it does not stop the app.

It stops the app if I try to use load_framework in order to retrieve NSAlert:
  - on the simulator because it says no suitable image found (see bold message log on first post)
  - on the real device because an error occurs while loading (see bold message log on first post)
 
We can get PyObjus working no hassle on MacOS, but we just get the dlopen error when running on iOS (10. It works on 9 and 8).

Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 9): no suitable image found.

I never tried it before but as you said, no hassle on mac (for both NSString and NSAlert)

I do have the error on iOS 9.3 (the only build setting I have on Xcode. Can select several deployment options but don't know what it changes). I don't have iOS 10. You say you manage to make NSAlert on version 9?
  - does it mean 9.3.5 too?
  - what is it that you set to 9 on Xcode, build setting or deployment? or both? I am not familiar with those

ZenCODE

unread,
Nov 1, 2016, 8:26:44 AM11/1/16
to Kivy users support

I do have the error on iOS 9.3 (the only build setting I have on Xcode. Can select several deployment options but don't know what it changes). I don't have iOS 10. You say you manage to make NSAlert on version 9?

We are not using NSAlert as such, but the NSString and other loads work. The background transfer works, so the Foundation class is loading. This work son iOS 9.3.5.

https://github.com/kivy/pyobjus/blob/master/examples/background_transfer.py

 
  - does it mean 9.3.5 too?
  - what is it that you set to 9 on Xcode, build setting or deployment? or both? I am not familiar with those

We actually set 8 as the deployment target (for compatibility) but it works on 9. It works all on our iOS devices and simulators, but just freeezes on iOS 10.

Still investigating. Will keep you posted...:-)

 

jcdude

unread,
Nov 2, 2016, 6:36:11 PM11/2/16
to Kivy users support
I'm coming up with the same error when running my app on a new install of Sierra.  Build works ok, but simulation fails with:
"Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation" etc

Target ios is 8.1, but using the 10.1 SDK.  Other ios versions also fail.  Yet to try other SDK versions, will try that next!

pierre....@gmail.com

unread,
Nov 22, 2016, 3:10:04 PM11/22/16
to Kivy users support
Hi again



Still investigating. Will keep you posted...:-)

 

Any news towards that? Have you been able to identify / correct the issue with the load_framework?

Thanks,
Pierre

ZenCODE

unread,
Nov 22, 2016, 3:26:35 PM11/22/16
to Kivy users support
We've added logging for that error and it seems limited to the simulators. dlopen for foundation works without issues on real devices. The logging has been fixed so running with the latest pull, the XCode console output should confirm that. And I can confirm that pyobjus works on Sierra + deploying to iOS 10/10.1 devices (for us anyway :-))

So, the dlopen issue seems a limitation of simulators. Not sure what Kivy can really do about that? Can you confirm this by testing on a device?

Jonathan Clarke

unread,
Nov 23, 2016, 3:16:06 AM11/23/16
to kivy-...@googlegroups.com
I can confirm that I was able to use that patch to find that there were some errors coming from elsewhere in my code.

Since then I've been able to use osx sierra to deploy & run on an ios device and I am even able to use the simulator.

Thanks for the patch!

On 22 Nov 2016 8:26 p.m., "ZenCODE" <zenkey....@gmail.com> wrote:
We've added logging for that error and it seems limited to the simulators. dlopen for foundation works without issues on real devices. The logging has been fixed so running with the latest pull, the XCode console output should confirm that. And I can confirm that pyobjus works on Sierra + deploying to iOS 10/10.1 devices (for us anyway :-))

So, the dlopen issue seems a limitation of simulators. Not sure what Kivy can really do about that? Can you confirm this by testing on a device?

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/cfXs-OGL0Jo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ZenCODE

unread,
Nov 23, 2016, 7:32:38 AM11/23/16
to Kivy users support
Awesomeness :-)

pierre....@gmail.com

unread,
Dec 1, 2016, 11:56:14 AM12/1/16
to Kivy users support
Hi again, sorry for the delay!


Le mardi 22 novembre 2016 21:26:35 UTC+1, ZenCODE a écrit :
We've added logging for that error and it seems limited to the simulators. dlopen for foundation works without issues on real devices. The logging has been fixed so running with the latest pull, the XCode console output should confirm that. And I can confirm that pyobjus works on Sierra + deploying to iOS 10/10.1 devices (for us anyway :-))

So, the dlopen issue seems a limitation of simulators. Not sure what Kivy can really do about that? Can you confirm this by testing on a device?

My tests are not so concluent but result is now different.

I did the following to have the patch and the Xcode project generated:
  - ./toolchain.py distclean
  - rm -rf pxpapp-ios (folder created with toolchain create)
  - git pull
  - ./toolchain.py build kivy pyobjus (no error, I used to have an FTP issue here)
  - ./toolchain.py create PXPApp ../PXPApp-iOS
  - open pxpapp-ios/pxpapp.xcodeproj/

Here follows the Xcode output for a test on a real device (iPhone 4s, ios 9.3.5, Xcode 7.3.1 and OS X 10.11.6). I put in bold things that has changed since last time. Still having the error on load_framework call.

2016-12-01 17:42:40.695 pxpapp[290:32134] Available orientation: KIVY_ORIENTATION=LandscapeLeft LandscapeRight Portrait PortraitUpsideDown
2016-12-01 17:42:40.700 pxpapp[290:32134] PythonHome is: /var/containers/Bundle/Application/1622FDA3-A621-47E2-AF58-D7EFFF823622/pxpapp.app
2016-12-01 17:42:40.708 pxpapp[290:32134] Initializing python
2016-12-01 17:42:41.058 pxpapp[290:32134] Running main.pyo: /var/containers/Bundle/Application/1622FDA3-A621-47E2-AF58-D7EFFF823622/pxpapp.app/YourApp/main.pyo
[INFO              ] [Kivy        ] v1.9.1
[INFO              ] [Python      ] v2.7.1 (r271:86832, Dec  1 2016, 16:25:56)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
[INFO              ] [Factory     ] 179 symbols loaded
[INFO              ] [Image       ] Providers: img_imageio, img_tex, img_gif (img_dds, img_sdl2, img_ffpyplayer, img_pil ignored)
Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 1): image not found
Got fallback dlopen error on Foundation: dlopen(/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 1): image not found

[INFO              ] [Text        ] Provider: sdl2
[INFO              ] [OSC         ] using <thread> for socket
[INFO              ] [Window      ] Provider: sdl2
[INFO              ] [GL          ] OpenGL version <OpenGL ES 2.0 IMGSGX543-124.1>
[INFO              ] [GL          ] OpenGL vendor <Imagination Technologies>
[INFO              ] [GL          ] OpenGL renderer <PowerVR SGX 543>
[INFO              ] [GL          ] OpenGL parsed version: 2, 0
[INFO              ] [GL          ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO              ] [GL          ] Texture max size <4096>
[INFO              ] [GL          ] Texture max units <8>
[INFO              ] [Window      ] auto add sdl2 input provider
[INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
 Traceback (most recent call last):
   File "/Users/tjmaxgov/Desktop/kivy-ios/pxpapp-ios/YourApp/main.py", line 1010, in <module>

   File "/Users/tjmaxgov/Desktop/kivy-ios/build/kivy/i386/kivy-1.9.1/iosbuild/lib/python2.7/site-packages/kivy/app.py", line 802, in run
   File "/Users/tjmaxgov/Desktop/kivy-ios/pxpapp-ios/YourApp/main.py", line 866, in build

   File "/Users/tjmaxgov/Desktop/kivy-ios/build/pyobjus/i386/pyobjus-master/iosbuild/lib/python2.7/site-packages/pyobjus/dylib_manager.py", line 190, in load_framework
 pyobjus.pyobjus.ObjcException: Error while loading /System/Library/Frameworks/AppKit.framework framework
2016-12-01 17:42:44.782 pxpapp[290:32134] Application quit abnormally!
2016-12-01 17:42:44.875 pxpapp[290:32134] Leaving

Thanks for your time!
Reply all
Reply to author
Forward
0 new messages