FreeBSD, Python 2.2, bug: import math

Having some problems with getting Yable 0.30 to run on my primary setup.
FreeBSD 4.8-STABLE (Relatively ‘stock’ configuration)
Blender 2.27 (From binary, not compiled)
Python 2.2.2 (Compiled from ports tree)
Python path is set correctly for my system;
>>> print sys.path
[’’, ‘/usr/local/lib/python2.2’, ‘/usr/local/lib/python2.2/plat-freebsd4’, ‘/usr/local/lib/python2.2/lib-tk’, ‘/usr/local/lib/python2.2/lib-dynload’, ‘/usr/local/lib/python2.2/site-packages’, ‘/usr/local/lib/python2.2/site-packages/Numeric’, ‘/usr/local/lib/python2.2/site-packages/PIL’, ‘/usr/local/lib/python2.2/site-packages/gtk-2.0’]
>>>

The issue I’m having, in Yable 0.30, and other similar python scripts where any module in the lib-dynload directory is imported (ex; math ) I get errors when attempting to run the script.

My Win2k workstation, with same blender/python/yable versions, the bug cannot be recreated, however it does not have the .so versions of the file libraries.

Is there something I need to change to solve this problem? It is going to affect any script probably with similar configurations.

Try compiling it yourself. :slight_smile:

Also what is the output of
python -c “import distutils.sysconfig;
print distutils.sysconfig.get_config_var(‘LINKFORSHARED’)”

(Type it all on one line)
The output of this needs to be in the link.

Also, post the errors you get (from a console)

Output of the command is;

-Wl,–export-dynamic

I’ll scope out recompiling python. Looks like that last option might be the one that makes the dynamic modules. Without it, it should be fine. If it works, I’ll post the solution here, in case other people need to know.

Recompile blender, not python.
Those options export functions from the python interpreter (embedded in Blender) to python extensions written in C.

An autoconf build should pick this up, a patch will be needed to nan_link.mk if you use the NaN build system

Okay, I’ll start working on that. I just upgraded my autoconf, just need to work out where to add those lines and so on, to get what I need.

Okay, I’m having issues recompiling blender, I’ll need to solve that problem before I can continue solving this problem. I’ve upgraded my autoconf/automake to the latest versions available on gnu.org. What changes to the nan_link file do I need? Nothing is standing out to me right now…

If you are using autoconf, you shouldn’t have to make any changes.

If you are using the NaN build system, add
LOPTS = -Wl,–export-dynamic
between
ifeq ($(OS),freebsd)

and
endif

Sorry for the delay, “Real Life” and some other issues needed to be solved first.

Now, recompiled blender from CVS (The blender-devel in the ports tree does not run on my system) When I open up and run YaBle, it fails, the console returns these errors:

On the line; (line 35)
from math import *

Error:
Traceback (most recent call last):
File “Yable-0.30-3.py”, line 35, in ?
ImportError: /usr/local/lib/python2.2/lib-dynload/math.so: Undefined symbol “PyExc_FloatingPointError”

I don’t know if this could cause any problems or not, but Blender was made to use Python 2.0, maybe try it using that?

You definately need to get -Wl,–export-dynamic into the link.

If you used autoconf post config.log. Not the whole thing, just the result of ‘configure:10742: checking Python link args…’

If you delete the Blender binary, make should skip to the link and you can confirm if -Wl,… etc is in the command.

Ah! Now I’ve got it running. Much thanks!

Things I’ve found:
running:
compileblender_freebsd-4.7-i386.sh && gmake
is what I used, after adding in the -Wl,–export-dynamic to nan_link.mk
running the ./configure && gmake does not run for me, nor does the ports tree version in /ports/graphics/blender-devel/

Not documented, is that the binary ends up in /obj/freebsd-4.8-i386/bin I realize it should have been obvious, but it wasn’t for me.

Now all I need is free time to actually -do- something…

Excellent.

I’ve sent a patch and it’s been committed to CVS.