开发者

Building Python libraries on a Mac and experiencing flat namespace errors

开发者 https://www.devze.com 2023-01-17 17:53 出处:网络
As a general rule, I rue the days whenever I have to build Python libraries on a Mac. I\'ve generally had fairly good success using Boost::Python, and if I use distutils, most of the time everything w

As a general rule, I rue the days whenever I have to build Python libraries on a Mac. I've generally had fairly good success using Boost::Python, and if I use distutils, most of the time everything works correctly.

开发者_JAVA技巧However, I've never been able figure out the exact combination of what works/what doesn't work. Specifically, I've often run into the dreaded problem of a symbol not being found because the library I'm trying to use doesn't have a flat namespace. I've tried switching to the MacPorts version of Python, and then using only MacPorts libraries, and no dice.

The most recent problem I ran into is a tool I need to use that is dependent on the OpenCV library, which in turn is dependent on the FFMPeg library (actually, both are). Everything compiles, but when I do 'import MYLIB', I get the symbol _pix_fmt_info not found in the flat namespace. I do a DYLIB_LIBRARY_PRINT to view all the libraries loaded, and sure enough libavformat, libavcodec, libavutil, and libswscale are all loaded.

So, here are my questions. The specific question, does anyone have an idea of what might be going on here. Do I need to build libffmpeg by hand? Am I doing something really stupid like forgetting a library (I checked, and I don't think I am..)

More generally, is there a good approach for dealing with the flat namespace issue? Do I always have to worry about which libraries are included? Does anyone have a good recipe for getting things to just work?

Sometimes I do miss the world of Linux..


edit


Sorry, it looks like it was my own stupidity at fault here. I haven't figured out the exact problem, but it looks like the unfound symbol belongs to a different library than I though (i.e. not libffmpeg).

I am still curious about other people's experiences with flat namespaces, however.


I have seen this issue when I compile the "C" python bindings with the option

-fvisibility=hidden parameter

on mac osx

I am of understanding is that, this is similar to flat namespace issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消