flupke / pypotrace

Python bindings for potrace library
Other
165 stars 43 forks source link

build failure on x86_64 and test failures once the compilation issue has been worked around #1

Closed teythoon closed 12 years ago

teythoon commented 13 years ago

I am having trouble building pypotrace on debian squeeze on x86_64 (building it on x86 works fine):

g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6/potrace/bezier.o -lagg -o build/lib.linux-x86_64-2.6/potrace/bezier.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/libagg.a(agg_curves.o): relocation R_X86_64_32 against `__gxx_personality_v0' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/libagg.a: could not read symbols: Bad value

After recompiling libagg with -fPIC, pypotrace builds fine but fails to find any edges:

python test_basic.py
Traceback (most recent call last):
  File "test_basic.py", line 48, in <module>
    test_trace()
  File "test_basic.py", line 32, in test_trace
    assert_equal(points, ref_points)
  File "/usr/lib/python2.6/unittest.py", line 350, in failUnlessEqual
    (msg or '%r != %r' % (first, second))
AssertionError: [] != [(8.0, 8.0), (16.0, 8.0), (24.0, 8.0), (24.0, 16.0), (24.0, 24.0), (16.0, 24.0), (8.0, 24.0), (8.0, 16.0)]
jboy commented 12 years ago

I also encountered this build problem on my x86_64 machine running Ubuntu. To fix it, edit the file "setup.py" to change some values in the 'ext_modules' list.

Change both occurrences of: libraries=["agg"] to: libraries=["agg_pic"] to link against the version of libagg that was compiled with PIC support.

jboy commented 12 years ago

Also, I just checked and confirmed: The test failure is fixed by the patch I've submitted: https://github.com/flupke/pypotrace/pull/2