Discussion:
bakefile fails on Snow Leopard
(too old to reply)
Teo Fonrouge
2009-10-06 16:46:44 UTC
Permalink
Hello,

As subject, I'm unable to execute bakefile on Snow Leopard, here is my
output from an current SVN builded bakefile tree:

<output>

Using: gnu
Traceback (most recent call last):
File "/usr/local/bin/bakefile", line 237, in <module>
run(sys.argv[1:])
File "/usr/local/bin/bakefile", line 200, in run
import reader, writer
File "/usr/local/lib/bakefile/reader.py", line 31, in <module>
import mk
File "/usr/local/lib/bakefile/mk.py", line 30, in <module>
import bkl_c
File "/usr/local/lib/bakefile/bkl_c.py", line 7, in <module>
import _bkl_c
ImportError: dynamic module does not define init function (init_bkl_c)

</output>


For sure, there must be something that I've missed. Any help would be
appreciated.


best regards,

Teo Fonrouge
Scott Bailey
2009-10-06 20:05:27 UTC
Permalink
Huh? I've got access to a snow leopard machine -- although I have a few
basically irrelevant tweaks in my Bakefile that I need to provide back to
Vaclav -- and Bakefile works fine for me. Can you provide more context?
(i.e. send us the .bkl)

SB
Post by Teo Fonrouge
Hello,
As subject, I'm unable to execute bakefile on Snow Leopard, here is my
<output>
Using: gnu
File "/usr/local/bin/bakefile", line 237, in <module>
run(sys.argv[1:])
File "/usr/local/bin/bakefile", line 200, in run
import reader, writer
File "/usr/local/lib/bakefile/reader.py", line 31, in <module>
import mk
File "/usr/local/lib/bakefile/mk.py", line 30, in <module>
import bkl_c
File "/usr/local/lib/bakefile/bkl_c.py", line 7, in <module>
import _bkl_c
ImportError: dynamic module does not define init function (init_bkl_c)
</output>
For sure, there must be something that I've missed. Any help would be
appreciated.
best regards,
Teo Fonrouge
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Bakefile-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bakefile-devel
--
Scott Bailey
Teo Fonrouge
2009-10-06 20:39:48 UTC
Permalink
Post by Scott Bailey
Huh? I've got access to a snow leopard machine -- although I have a
few basically irrelevant tweaks in my Bakefile that I need to
provide back to Vaclav -- and Bakefile works fine for me. Can you
provide more context? (i.e. send us the .bkl)
I've just removed on my system the whole SVN bakefile app and
installed the one in the download page of bakefile.org.

I had tried with the sample under the "bakefile/tests/cond" dir in the
bakefile tree and this is the output:

<output>

bash-3.2$ bakefile -f gnu hello.bkl
Traceback (most recent call last):
File "/usr/local/lib/bakefile/bakefile.py", line 237, in <module>
run(sys.argv[1:])
File "/usr/local/lib/bakefile/bakefile.py", line 200, in run
import reader, writer
File "/usr/local/lib/bakefile/reader.py", line 31, in <module>
import mk
File "/usr/local/lib/bakefile/mk.py", line 30, in <module>
import bkl_c
File "/usr/local/lib/bakefile/bkl_c.py", line 25, in <module>
_bkl_c = swig_import_helper()
File "/usr/local/lib/bakefile/bkl_c.py", line 17, in
swig_import_helper
import _bkl_c
ImportError: No module named _bkl_c

</output>


best regards,

Teo Fonrouge
Scott Bailey
2009-10-06 21:33:01 UTC
Permalink
I am using a mildly patched bakefile from svn based on version 1303. 1320
is in today's SVN. I have success w/ both gnu and xcode 2 builds for the
example noted.
Post by Teo Fonrouge
Post by Scott Bailey
Huh? I've got access to a snow leopard machine -- although I have a
few basically irrelevant tweaks in my Bakefile that I need to
provide back to Vaclav -- and Bakefile works fine for me. Can you
provide more context? (i.e. send us the .bkl)
I've just removed on my system the whole SVN bakefile app and
installed the one in the download page of bakefile.org.
I had tried with the sample under the "bakefile/tests/cond" dir in the
<output>
bash-3.2$ bakefile -f gnu hello.bkl
File "/usr/local/lib/bakefile/bakefile.py", line 237, in <module>
run(sys.argv[1:])
File "/usr/local/lib/bakefile/bakefile.py", line 200, in run
import reader, writer
File "/usr/local/lib/bakefile/reader.py", line 31, in <module>
import mk
File "/usr/local/lib/bakefile/mk.py", line 30, in <module>
import bkl_c
File "/usr/local/lib/bakefile/bkl_c.py", line 25, in <module>
_bkl_c = swig_import_helper()
File "/usr/local/lib/bakefile/bkl_c.py", line 17, in
swig_import_helper
import _bkl_c
ImportError: No module named _bkl_c
</output>
best regards,
Teo Fonrouge
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Bakefile-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bakefile-devel
--
Scott Bailey
Teo Fonrouge
2009-10-06 21:44:08 UTC
Permalink
Post by Scott Bailey
I am using a mildly patched bakefile from svn based on version
1303. 1320 is in today's SVN. I have success w/ both gnu and xcode
2 builds for the example noted.
That patch would be very appreciated :)


Thank you Scott.


best regards,

Teo Fonrouge
Scott Bailey
2009-10-06 22:03:06 UTC
Permalink
Teo,

The patch is minor tweaks to xcode2. If you are planning to use xcode2 for
your work I'll try to get them in this week. If you aren't using xcode2 it
just doesn't matter....

SB
Post by Scott Bailey
I am using a mildly patched bakefile from svn based on version 1303. 1320
is in today's SVN. I have success w/ both gnu and xcode 2 builds for the
example noted.
That patch would be very appreciated :)
Thank you Scott.
best regards,
Teo Fonrouge
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Bakefile-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bakefile-devel
--
Scott Bailey
Teo Fonrouge
2009-10-06 22:10:44 UTC
Permalink
Post by Scott Bailey
Teo,
The patch is minor tweaks to xcode2. If you are planning to use
xcode2 for your work I'll try to get them in this week. If you
aren't using xcode2 it just doesn't matter....
Doesn't matter, I'm not using xcode2.


Thank you Scott.


best regards,

Teo Fonrouge
Vaclav Slavik
2009-10-06 20:18:59 UTC
Permalink
Hi,
Post by Teo Fonrouge
ImportError: dynamic module does not define init function (init_bkl_c)
...
Post by Teo Fonrouge
For sure, there must be something that I've missed. Any help would be
appreciated.
The next step in debugging this is obvious: did you check whether the
compiled module does or does not define this symbol? If it doesn't, why?
(You have the SWIG-generated sources, it shouldn't be hard to figure
out). If it does define the symbol, you'll have to figure out why Python
doesn't find it.

Vaclav
Teo Fonrouge
2009-10-06 20:52:24 UTC
Permalink
Post by Vaclav Slavik
Hi,
Post by Teo Fonrouge
ImportError: dynamic module does not define init function
(init_bkl_c)
...
Post by Teo Fonrouge
For sure, there must be something that I've missed. Any help would be
appreciated.
The next step in debugging this is obvious: did you check whether the
compiled module does or does not define this symbol? If it doesn't, why?
(You have the SWIG-generated sources, it shouldn't be hard to figure
out). If it does define the symbol, you'll have to figure out why Python
doesn't find it.
Hello,

I've removed on my system the installed SVN bakefile and installed the
one on the download page of bakefile.org and this is the output with
the "bakefile/tests/cond" :

<output>

bash-3.2$ bakefile -f gnu hello.bkl
Traceback (most recent call last):
File "/usr/local/lib/bakefile/bakefile.py", line 237, in <module>
run(sys.argv[1:])
File "/usr/local/lib/bakefile/bakefile.py", line 200, in run
import reader, writer
File "/usr/local/lib/bakefile/reader.py", line 31, in <module>
import mk
File "/usr/local/lib/bakefile/mk.py", line 30, in <module>
import bkl_c
File "/usr/local/lib/bakefile/bkl_c.py", line 25, in <module>
_bkl_c = swig_import_helper()
File "/usr/local/lib/bakefile/bkl_c.py", line 17, in
swig_import_helper
import _bkl_c
ImportError: No module named _bkl_c

</output>

Can you point me how can I check if the compiled module contains the
missing symbol ?


Thanks in advance.


best regards,

Teo Fonrouge
Kevin Ollivier
2009-10-06 21:31:35 UTC
Permalink
Hi Teo,
Post by Teo Fonrouge
Post by Vaclav Slavik
Hi,
Post by Teo Fonrouge
ImportError: dynamic module does not define init function
(init_bkl_c)
...
Post by Teo Fonrouge
For sure, there must be something that I've missed. Any help would be
appreciated.
The next step in debugging this is obvious: did you check whether the
compiled module does or does not define this symbol? If it doesn't, why?
(You have the SWIG-generated sources, it shouldn't be hard to figure
out). If it does define the symbol, you'll have to figure out why Python
doesn't find it.
Hello,
I've removed on my system the installed SVN bakefile and installed the
one on the download page of bakefile.org and this is the output with
<output>
bash-3.2$ bakefile -f gnu hello.bkl
File "/usr/local/lib/bakefile/bakefile.py", line 237, in <module>
run(sys.argv[1:])
File "/usr/local/lib/bakefile/bakefile.py", line 200, in run
import reader, writer
File "/usr/local/lib/bakefile/reader.py", line 31, in <module>
import mk
File "/usr/local/lib/bakefile/mk.py", line 30, in <module>
import bkl_c
File "/usr/local/lib/bakefile/bkl_c.py", line 25, in <module>
_bkl_c = swig_import_helper()
File "/usr/local/lib/bakefile/bkl_c.py", line 17, in
swig_import_helper
import _bkl_c
ImportError: No module named _bkl_c
</output>
Can you point me how can I check if the compiled module contains the
missing symbol ?
This is likely due to a mismatch between 32-bit and 64-bit between
Python and Bakefile's C extension.

I don't think Bakefile currently checks and compiles the extension to
match the architecture used by Python itself, or reports if there's a
mismatch. I think it just uses the compiler's default architecture,
which differs depending on which OS you compiled on or which Python
you're using.

Regards,

Kevin
Post by Teo Fonrouge
Thanks in advance.
best regards,
Teo Fonrouge
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Bakefile-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bakefile-devel
Teo Fonrouge
2009-10-06 21:42:10 UTC
Permalink
Post by Kevin Ollivier
Hi Teo,
[snip]
Post by Kevin Ollivier
This is likely due to a mismatch between 32-bit and 64-bit between
Python and Bakefile's C extension.
I don't think Bakefile currently checks and compiles the extension to
match the architecture used by Python itself, or reports if there's a
mismatch. I think it just uses the compiler's default architecture,
which differs depending on which OS you compiled on or which Python
you're using.
Okay, IOW this means that this can be solved by giving the right
params to ./configure ?


Thank you Kevin.



best regards,

Teo Fonrouge
Kevin Ollivier
2009-10-06 21:50:12 UTC
Permalink
Hi Teo,
Post by Teo Fonrouge
Post by Kevin Ollivier
Hi Teo,
[snip]
Post by Kevin Ollivier
This is likely due to a mismatch between 32-bit and 64-bit between
Python and Bakefile's C extension.
I don't think Bakefile currently checks and compiles the extension to
match the architecture used by Python itself, or reports if there's a
mismatch. I think it just uses the compiler's default architecture,
which differs depending on which OS you compiled on or which Python
you're using.
Okay, IOW this means that this can be solved by giving the right
params to ./configure ?
For my case (32-bit Python on SnowLeopard), I fixed the problem by
setting CC="gcc-4.0" and CXX="g++-4.0" before building Bakefile. 32-
bit is the default for that version of the compiler.

Regards,

Kevin
Post by Teo Fonrouge
Thank you Kevin.
best regards,
Teo Fonrouge
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
Bakefile-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bakefile-devel
John Ralls
2009-10-07 02:29:59 UTC
Permalink
Post by Kevin Ollivier
For my case (32-bit Python on SnowLeopard), I fixed the problem by
setting CC="gcc-4.0" and CXX="g++-4.0" before building Bakefile. 32-
bit is the default for that version of the compiler.
To clarify a bit:

If (and only if) you have installed Snow Leopard on a 64-bit-capable
Mac (core2duo or xeon, but not core duo), the default compiler is
gcc-4.2.0 and it defaults to arch x86_64.

There are several ways to coerce 32-bit compilation: You can specify
by any number of ways of coercing 32-bit compilation: As Kevin said,
gcc-4.0 (also provided by DevTools) defaults to 32-bit compilation.
Including -arch i386 or -m32 in CFLAGS, CXXFLAGS, OBJCFLAGS, and
LDFLAGS will coerce any Apple gcc to 32-bit (non-Apple gccs don't
understand the -arch flag; they also don't understand Frameworks). I
think that if you specify one of the older SDKs (10.5 or 10.4u) you'll
get 32bit compilation by default, but I haven't tested that. (Note
that you can specify -arch i386 -arch x86_64 and get a universal
binary that can link either way as needed.)

/usr/bin/python is a universal binary of version 2.6.1, containing 32-
bit ppc, 32-bit i386, and 64-bit x86_64 architectures. On a 64-bit
machine, x86_64 is the default, but there are several ways to change
it; man python has the details. There are of course several ways to
install and use a custom python as well. The important thing to
remember is that all loadable compiled-and-linked modules must have
available the selected architecture that python is launched with.

Regards,
John Ralls
Vaclav Slavik
2009-10-07 05:02:54 UTC
Permalink
Post by Kevin Ollivier
I don't think Bakefile currently checks and compiles the extension to
match the architecture used by Python itself
Bakefile's binary package contains the extension for more archs and
versions, but it doesn't account for Snow Leopard yet. Here's a blind
patch to makepkg.sh to compile 10.6 version too (just run the script
from macosx directory):



Index: macosx/makepkg.sh
===================================================================
--- macosx/makepkg.sh (revision 1316)
+++ macosx/makepkg.sh (working copy)
@@ -59,6 +59,7 @@

build_with_sdk "10.4u" "10.4" "2.3" "ppc i386"
build_with_sdk "10.5" "10.5" "2.5" "ppc i386"
+build_with_sdk "10.6" "10.6" "2.6" "i386 x86_64"

if [ -n "$EXTRA_BINMODULES" ] ; then
(cd $EXTRA_BINMODULES ; tar c .) | (cd $pydir/binmodules ; tar x)



(It's my understanding that 10.6 is Intel-only and so building ppc or
even ppc64 versions doesn't make sense anymore.)

I didn't install 10.6 yet, so any testing of this patch would be much
appreciated.

Thanks,
Vaclav

Loading...