crashing mac application: vfprintf_l

44 views
Skip to first unread message

jelle feringa

unread,
Apr 26, 2013, 10:08:10 AM4/26/13
to pyins...@googlegroups.com
Hi,

I'm getting an awkward error when trying to compile a mac application that uses the PythonOCC CAD library.
However, it seems that the error seems unrelated to that lib:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_c.dylib             0x00007fff8f5086b0 strlen + 16
1   libsystem_c.dylib             0x00007fff8f58fa65 __vfprintf + 4704
2   libsystem_c.dylib             0x00007fff8f58e337 vfprintf_l + 727
3   pyocc                         0x0000000109b4b9e2 0x109b36000 + 88546
4   pyocc                         0x0000000109b38261 0x109b36000 + 8801
5   pyocc                         0x0000000109b37b9e 0x109b36000 + 7070
6   pyocc                         0x0000000109b4bb78 0x109b36000 + 88952
7   pyocc                         0x0000000109b37454 0x109b36000 + 5204

but rather a stdio.h related issue.
I've tried both building with and without a console, that does not alter the behaviour

Any ideas how I could further track down this error?
Thanks, Pyinstaller seems an awesome tool,

-jelle


This is the .spec 

# -*- mode: python -*-

import sys
sys.path.insert(0, "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages")

_path = "/Users/jelleferinga/Documents/workspace/PyRAPID/Code/PyRAPID/build/hooks_development/simple_pythonocc"
_opt_site_packages = "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages"
_site_packages = "/Library/Python/2.6/site-packages"


a = Analysis(['simple_pyocc.py'],
             pathex=[_path, _site_packages, _opt_site_packages, ],
             hiddenimports=["OCC", "sip", "PyKDL", "traitsui"],
             hookspath=[_path],
             runtime_hooks=None,
             excludes=["matplotlib", "PySide", "FixTk"]
             )
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=False,
          name='pyocc',
          debug=False,
          strip=None,
          upx=True,
          console=False )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='pyocc_')
app = BUNDLE(coll,
             name='pyocc.app')


which is called by

python /Users/jelleferinga/GIT/pyinstaller/pyinstaller.py --onedir --noconfirm pyocc.spec

hook-OCC.py:

import os, glob
_pth = "/Library/Python/2.6/site-packages/OCC"
sos = glob.glob(os.path.join(_pth, "*.so"))
pys = glob.glob(os.path.join(_pth, "*.py"))


def fname_no_extension(file_path):
    module_name = os.path.splitext( os.path.split(file_path)[1] )[0]
    module = "OCC"
    return "{module}.{module_name}".format(**vars())

hiddenimports =  [ fname_no_extension(i) for i in sos ]
hiddenimports += [ fname_no_extension(i) for i in pys ]

finally, Pyinstaller doesnt really put out any warnings:

jf:simple_pythonocc jelleferinga$ ./compile_simple_pyocc.sh 
23 WARNING: You are running 64-bit Python: created binaries will only work on Mac OS X 10.6+.
If you need 10.4-10.5 compatibility, run Python as a 32-bit binary with this command:

    VERSIONER_PYTHON_PREFER_32_BIT=yes arch -i386 /usr/bin/python

4029 INFO: UPX is not available.
4052 INFO: Processing hook hook-os
4150 INFO: Processing hook hook-time
4165 INFO: Processing hook hook-cPickle
4222 INFO: Processing hook hook-_sre
4338 INFO: Processing hook hook-cStringIO
4436 INFO: Processing hook hook-encodings
4450 INFO: Processing hook hook-codecs
4719 INFO: Extending PYTHONPATH with /Users/jelleferinga/Documents/workspace/PyRAPID/Code/PyRAPID/build/hooks_development/simple_pythonocc
4719 INFO: checking Analysis
4719 INFO: building Analysis because out00-Analysis.toc non existent
4719 INFO: running Analysis out00-Analysis.toc
4728 INFO: Analyzing /Users/jelleferinga/GIT/pyinstaller/PyInstaller/loader/_pyi_bootstrap.py
4742 INFO: Processing hook hook-os
4749 INFO: Processing hook hook-site
4856 INFO: Processing hook hook-time
4871 INFO: Processing hook hook-cPickle
4930 INFO: Processing hook hook-_sre
5051 INFO: Processing hook hook-cStringIO
5147 INFO: Processing hook hook-encodings
5162 INFO: Processing hook hook-codecs
5482 INFO: Processing hook hook-pydoc
5782 INFO: Processing hook hook-email
5839 INFO: Processing hook hook-httplib
5871 INFO: Processing hook hook-email.message
5988 INFO: Analyzing /Users/jelleferinga/GIT/pyinstaller/PyInstaller/loader/pyi_importers.py
6026 INFO: Analyzing /Users/jelleferinga/GIT/pyinstaller/PyInstaller/loader/pyi_archive.py
6059 INFO: Analyzing /Users/jelleferinga/GIT/pyinstaller/PyInstaller/loader/pyi_carchive.py
6093 INFO: Analyzing /Users/jelleferinga/GIT/pyinstaller/PyInstaller/loader/pyi_os_path.py
6099 INFO: Analyzing simple_pyocc.py
6107 INFO: Processing hook hook-OCC
21826 INFO: Hidden import 'OCC' has been found otherwise
21826 INFO: Hidden import 'encodings' has been found otherwise
21826 INFO: Looking for run-time hooks
21827 INFO: Analyzing rthook /Users/jelleferinga/GIT/pyinstaller/PyInstaller/loader/rthooks/pyi_rth_encodings.py
26849 INFO: Using Python library /System/Library/Frameworks/Python.framework/Versions/2.6/Python
38694 INFO: Warnings written to /Users/jelleferinga/Documents/workspace/PyRAPID/Code/PyRAPID/build/hooks_development/simple_pythonocc/build/pyocc/warnpyocc.txt
38779 INFO: checking PYZ
38780 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
38780 INFO: building PYZ (ZlibArchive) out00-PYZ.toc
44046 INFO: checking PKG
44046 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
44046 INFO: building PKG (CArchive) out00-PKG.pkg
44091 INFO: checking EXE
44092 INFO: rebuilding out00-EXE.toc because pyocc missing
44092 INFO: building EXE from out00-EXE.toc
44097 INFO: Appending archive to EXE /Users/jelleferinga/Documents/workspace/PyRAPID/Code/PyRAPID/build/hooks_development/simple_pythonocc/dist/pyocc
44110 INFO: checking COLLECT
44110 INFO: building COLLECT out00-COLLECT.toc
53007 INFO: checking BUNDLE
53007 INFO: building BUNDLE out00-BUNDLE.toc








Daniel Hyams

unread,
Apr 26, 2013, 10:16:48 AM4/26/13
to PyInstaller
I'm assuming that your script/application runs fine when not packaged by PyInstaller?

Also, IMO, it's highly unlikely that there is a problem in the C standard libs.  Much more likely is that pyocc is passing junk to the vfprintf function (for example, a NULL or uninitialized file pointer).

To track this down, you really need to write as short of a script as possible that reproduces the problem; it looks like your app is reasonably complex, and it will be neigh on impossible to separate out that complexity.  I know this is for wxPython, but the same concepts apply: http://wiki.wxpython.org/MakingSampleApps









--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To post to this group, send email to pyins...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Daniel Hyams
dhy...@gmail.com

jelle feringa

unread,
Apr 26, 2013, 12:29:37 PM4/26/13
to pyins...@googlegroups.com

I'm assuming that your script/application runs fine when not packaged by PyInstaller?

;)
 
Also, IMO, it's highly unlikely that there is a problem in the C standard libs.  Much more likely is that pyocc is passing junk to the vfprintf function (for example, a NULL or uninitialized file pointer)

Aha... alright... 
 
To track this down, you really need to write as short of a script as possible that reproduces the problem; it looks like your app is reasonably complex, and it will be neigh on impossible to separate out that complexity.  I know this is for wxPython, but the same concepts apply: http://wiki.wxpython.org/MakingSampleApps

Absolutely... alas, that was what I've been doing, trying to go from compiling "print hello world" and now moving onto:

print 'OCC test...'

try:
    from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
    box = BRepPrimAPI_MakeBox(1,1,1).Shape()
except ImportError:
    print "could not load OCC.BRepPrimAPI"

print 'hope things played out...'

So that's how I'm trying to approach this, its indeed a complex app, that's why going for the piecemeal approach...

Thanks,

-jelle




Reply all
Reply to author
Forward
0 new messages