Building blender as python module

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
wbronchart
Posts: 0
Joined: Mon Apr 08, 2013 2:39 pm
Location: United Kingdom

Building blender as python module

Post by wbronchart » Tue Apr 09, 2013 12:01 pm

I'm trying to build blender as a python module by following these tutorials:
http://wiki.blender.org/index.php/Dev:2 ... lender/Mac
http://wiki.blender.org/index.php/User: ... AsPyModule

All works fine until when it starts linking I get this error. I'm compiline it on a mac osx 10.8

Code: Select all

Linking CXX shared module ../../bin/bpy.so
Undefined symbols for architecture x86_64:
  "_user_locale", referenced from:
      _bl_locale_set in libbf_intern_locale.a(boost_locale_wrapper.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea's how to fix this?

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Tue Apr 09, 2013 3:37 pm

Using an older version of Boost?

wbronchart
Posts: 0
Joined: Mon Apr 08, 2013 2:39 pm
Location: United Kingdom

Post by wbronchart » Tue Apr 09, 2013 3:38 pm

I've checked out /lib/darwin-9.x.universal from blenders source. Is that old? Should I be using another one?

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Tue Apr 09, 2013 3:46 pm

Not sure if the lib stuff in svn is still valid for OSX (or any other platform) Our install_deps script does Boost 1.51.

wbronchart
Posts: 0
Joined: Mon Apr 08, 2013 2:39 pm
Location: United Kingdom

Post by wbronchart » Tue Apr 09, 2013 4:04 pm

Hey thanks. I've looked into that, but it looks like the install_deps.sh script is broken:

Code: Select all

build_environment waldob$ sh install_deps.sh --help
cat: /proc/cpuinfo: No such file or directory
sed: illegal option -- r

(...)

Do you want to continue (Y/n)?Y
install_deps.sh: line 1618: [: =: unary operator expected
install_deps.sh: line 1629: [: =: unary operator expected
install_deps.sh: line 1648: [: =: unary operator expected
install_deps.sh: line 1674: [: too many arguments
install_deps.sh: line 1711: [: =: unary operator expected

install_deps.sh: line 1544: [: too many arguments
install_deps.sh: line 1546: [: =: unary operator expected
Building Python-3.3.0
Ensuring /opt/lib exists and is writable by us

wbronchart
Posts: 0
Joined: Mon Apr 08, 2013 2:39 pm
Location: United Kingdom

Post by wbronchart » Tue Apr 09, 2013 4:08 pm

To clarify. I'm building on mac

wbronchart
Posts: 0
Joined: Mon Apr 08, 2013 2:39 pm
Location: United Kingdom

Post by wbronchart » Tue Apr 09, 2013 4:50 pm

so uhm, I think that script only works on linux. I'm trying to update the boost library myself, but even if that works, I'm pretty sure there will be other issues

yakupdogan
Posts: 0
Joined: Sat Aug 31, 2013 10:57 am

Undefined symbols for architecture x86_64

Post by yakupdogan » Sat Aug 31, 2013 12:29 pm

wbronchart wrote:so uhm, I think that script only works on linux. I'm trying to update the boost library myself, but even if that works, I'm pretty sure there will be other issues
Hey, I have the same problem on my Mac:

Undefined symbols for architecture x86_64:

I have an 64 Bit architecture platform and have checked out the darwin-9.x.universal lib. I could also compile blender. But the problem occurs, when I change the cmake-options for getting blender as module

WITH_PYTHON_INSTALL=OFF
WITH_PLAYER=OFF
WITH_PYTHON_MODULE=ON

You probably solved the problem and I would be happy, if you can post the solution..

kureta
Posts: 0
Joined: Thu Oct 10, 2013 1:03 am

Re: Undefined symbols for architecture x86_64

Post by kureta » Thu Oct 10, 2013 1:10 am

yakupdogan wrote:
wbronchart wrote:so uhm, I think that script only works on linux. I'm trying to update the boost library myself, but even if that works, I'm pretty sure there will be other issues
Hey, I have the same problem on my Mac:

Undefined symbols for architecture x86_64:

I have an 64 Bit architecture platform and have checked out the darwin-9.x.universal lib. I could also compile blender. But the problem occurs, when I change the cmake-options for getting blender as module

WITH_PYTHON_INSTALL=OFF
WITH_PLAYER=OFF
WITH_PYTHON_MODULE=ON

You probably solved the problem and I would be happy, if you can post the solution..
I have just registered to this site to answer your post. It has been a frustrating challange for me, so i suppose it was the same for you, considering you have never got an answer.

I just edited blender-2.68/intern/locale/boost_locale_wrapper.cpp file like this:

ORIGINAL:

Code: Select all

#ifdef __APPLE__
			extern char GHOST_user_locale[128]; // pulled from Ghost_SystemCocoa
			std::string locale_osx = GHOST_user_locale + std::string(".UTF-8");
			_locale = gen(locale_osx.c_str());
#else
NEW:

Code: Select all

#ifdef __APPLE__aaaa
			extern char GHOST_user_locale[128]; // pulled from Ghost_SystemCocoa
			std::string locale_osx = GHOST_user_locale + std::string(".UTF-8");
			_locale = gen(locale_osx.c_str());
#else
just to prevent it from entering into #ifdef

now localization does not work but everything else is ok.

Hope it helps.

wbronchart
Posts: 0
Joined: Mon Apr 08, 2013 2:39 pm
Location: United Kingdom

Post by wbronchart » Sat Oct 19, 2013 11:40 pm

cool thanks! I'll give that another try.

Post Reply