I wouldn't think that frameworks is the issue, as I've successfully built with 
Mac frameworks installs before, but I may be wrong.

After all the attempts to rebuild everything, and then reverting back until 
things seemed to work, I ended up with changes that caused pyinstaller to fail 
in finding the python executable.  I got that to work by changing build.py from:

580  elif is_darwin:
586      lib = os.path.join(sys.exec_prefix, 'Python')

to:

586      lib = os.path.join(sys.exec_prefix, 'bin/python')

In my current installation, sys.exec_prefix ends up as "/usr/local"

With that working, I started looking at the Tcl/tk stuff.  In tracing build.py 
I noticed that, despite the error, 
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl and the equivalent tk 
executable were both being processed during the build.

As posted earlier, the error message comes from hook-_tkinter.py.  The existing 
code looks like this (error message comes from calling routine):

def find_tk_darwin(binaries):
    pattern = re.compile(r'_tkinter')
    for nm, fnm in binaries:
        mo = pattern.match(nm)
        if not mo:
            continue
        TCL_root = "/System/Library/Frameworks/Tcl.framework/Versions/Current"
        TK_root = "/System/Library/Frameworks/Tk.framework/Versions/Current"

        return TCL_root, TK_root

mo = pattern.match(nm) always returns "None", so the continue statement is 
always taken and the last three lines are never executed.  I'm a little baffled 
by the re.compile call, but the function is looking for a match with 'Tcl' and 
then with 'Tk' .

I moved the last three statements out of the for loop, which cleared the error 
message but didn't really advance my understanding of the problem.

I had been building with '-F -w' options, so I removed the options and built 
again.  Looking in the dist folder, I see that Tcl and tk are already there, as 
I mentioned above.  I ran otools on the copy of _tkinter.so there, and got:

        @executable_path/Tcl (compatibility version 8.5.0, current version 
8.5.11)
        @executable_path/Tk (compatibility version 8.5.0, current version 
8.5.11)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 
1105.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 159.1.0)

When I execute ..dist/appname.app/Contents/MacOS/appname I get:

ImportError: 
dlopen(/var/folders/qq/h5gj3f3s0rx41lhd7h0lt2hm0000gn/T/_MEIigFuUi/_tkinter.so, 
2): Library not loaded: @executable_path/Tcl
  Referenced from: 
/var/folders/qq/h5gj3f3s0rx41lhd7h0lt2hm0000gn/T/_MEIigFuUi/_tkinter.so
  Reason: image not found

Which is exactly the same thing I get if I use the original hook-_tkinter.py 
without alterations. 

../dist/appname/_MEI contains:

drwxr-xr-x  7 lynn  lynn  238 Mar 14 14:45 Tcl.framework
drwxr-xr-x  7 lynn  lynn      238 Mar 14 14:45 Headers
drwxr-xr-x  7 lynn  lynn      238 Mar 14 14:45 PrivateHeaders
drwxr-xr-x  7 lynn  lynn      238 Mar 14 14:45 Resources
-rw-r--r--  1 lynn  lynn  2107080 Nov  7 11:18 Tcl
-rw-r--r--  1 lynn  lynn     5088 Nov  7 11:18 libtclstub8.5.a

drwxr-xr-x  7 lynn  lynn  238 Mar 14 14:45 Tk.framework
drwxr-xr-x   8 lynn  lynn      272 Mar 14 14:45 Headers
drwxr-xr-x  10 lynn  lynn      340 Mar 14 14:45 PrivateHeaders
drwxr-xr-x   6 lynn  lynn      204 Mar 14 14:45 Resources
-rw-r--r--   1 lynn  lynn  2920948 Nov  7 11:20 Tk
-rw-r--r--   1 lynn  lynn    11528 Nov  7 11:20 libtkstub8.5.a

I dont know what @executable_path resolves to at run time, but ../dist/appname 
also contains a copy of Tcl and tk:

-rwxr-xr-x  1 lynn  lynn  2107080 Mar 14 14:45 Tcl
-rwxr-xr-x  1 lynn  lynn  2920948 Mar 14 14:45 tk

I'm at a loss at to what else to look at right now, so any suggestions would be 
welcomed.  

Lynn

On Mar 14, 2012, at 7:31 AM, Martin Zibricky wrote:

> Lynn Oliver píše v St 14. 03. 2012 v 00:16 -0700:
>> otool
>> -L /usr/local/lib/python2.7/lib-dynload/_tkinter.so 
>> /usr/local/lib/python2.7/lib-dynload/_tkinter.so: 
>> /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility version 
>> 8.5.0, current version 8.5.11) 
>> /Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 
>> 8.5.0, current version 8.5.11) /usr/lib/libgcc_s.1.dylib (compatibility 
>> version 1.0.0, current version 1105.0.0) /usr/lib/libSystem.B.dylib 
>> (compatibility version 1.0.0, current version 159.1.0) 
>> 
>> Updating hook-_tkinter.py with  
>> 
>> /Library/Frameworks/Tcl.framework/Versions/8.5 
>> /Library/Frameworks/Tk.framework/Versions/8.5 
>> 
>> Does not resolve the problem. ( I had already
>> tried .../Versions/Current, which is the same thing.) 
>> 
>> There must be something else pyinstaller needs to make this work. 
>> 
> 
> This could probably mean that pyinstaller is not able to handle
> frameworks from Mac properly. Files
> 
> /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
> /Library/Frameworks/Tk.framework/Versions/8.5/Tk
> 
> Should be present in the dist directory. Could you please try to copy
> these two files to the dist directory and try if your app is running?
> 
> If your app starts working with these files in the dist directory then
> please create a bug report for this.
> 
> I think that the cause is that pyinstaller is collecting only *.dylib
> files, but not framework files like those 'Tcl' and 'Tk'. These files do
> not end with .dylib extension.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "PyInstaller" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/pyinstaller?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to