pysrilm icon indicating copy to clipboard operation
pysrilm copied to clipboard

Installation problem

Open mdtux89 opened this issue 9 years ago • 6 comments

Hi! I tried installing this on python but when I run the setup script I get this:

/usr/bin/ld: /home/marco/srilm/lib/i686-m64/liboolm.a(Vocab.o): relocation R_X86_64_32 against `_ZSt4cerr' can not be used when making a shared object; recompile with -fPIC /home/marco/srilm/lib/i686-m64/liboolm.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status error: command 'c++' failed with exit status 1

Do you know how to fix this?

mdtux89 avatar Nov 15 '14 22:11 mdtux89

I don't, sorry! It looks like some problem with how you compiled srilm maybe? Pysrilm is a shared library that needs to link against the srilm libraries. The error message there says that your liboolm has been compiled in such a way that it can't be used from shared libraries. If you can find a way to recompile srilm with the -fPIC option then it'll probably work? On 15 Nov 2014 22:57, "Marco Damonte" [email protected] wrote:

Hi! I tried installing this on python but when I run the setup script I get this:

/usr/bin/ld: /home/marco/srilm/lib/i686-m64/liboolm.a(Vocab.o): relocation R_X86_64_32 against `_ZSt4cerr' can not be used when making a shared object; recompile with -fPIC /home/marco/srilm/lib/i686-m64/liboolm.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status error: command 'c++' failed with exit status 1

Do you know how to fix this?

— Reply to this email directly or view it on GitHub https://github.com/njsmith/pysrilm/issues/4.

njsmith avatar Nov 16 '14 01:11 njsmith

I'll try.. Thanks for the quick reply =) On 16 Nov 2014 01:02, "Nathaniel J. Smith" [email protected] wrote:

I don't, sorry! It looks like some problem with how you compiled srilm maybe? Pysrilm is a shared library that needs to link against the srilm libraries. The error message there says that your liboolm has been compiled in such a way that it can't be used from shared libraries. If you can find a way to recompile srilm with the -fPIC option then it'll probably work? On 15 Nov 2014 22:57, "Marco Damonte" [email protected] wrote:

Hi! I tried installing this on python but when I run the setup script I get this:

/usr/bin/ld: /home/marco/srilm/lib/i686-m64/liboolm.a(Vocab.o): relocation R_X86_64_32 against `_ZSt4cerr' can not be used when making a shared object; recompile with -fPIC /home/marco/srilm/lib/i686-m64/liboolm.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status error: command 'c++' failed with exit status 1

Do you know how to fix this?

— Reply to this email directly or view it on GitHub https://github.com/njsmith/pysrilm/issues/4.

— Reply to this email directly or view it on GitHub https://github.com/njsmith/pysrilm/issues/4#issuecomment-63199782.

mdtux89 avatar Nov 16 '14 01:11 mdtux89

This can be solved by recompiling SRILM using the -fPIC flag. To do this, modify SRILM's common/Makefile.machine.i686-m64 (or appropriate for you system) file and add -fPIC to the following lines like that:

ADDITIONAL_CFLAGS = -fopenmp -fPIC
ADDITIONAL_CXXFLAGS = -fopenmp -fPIC

Then make clean and make World SRILM.

I also had to modify pysrilm's setup.py a little. I you get errors about undefined symbol: gzvprintf, use the following section in pysrilm's setup.py and try again:

setup(
    cmdclass = {'build_ext': build_ext},
    ext_modules = [
      Extension("srilm",
                ["srilm.pyx"],
                language="c++",
                include_dirs=[SRILM_INCLUDE_DIR],
                libraries=["oolm", "dstruct", "misc", "z", "gomp"],
                library_dirs=[SRILM_LIB_DIR],
                extra_compile_args=['-fopenmp', '-fPIC'],
                )
      ],
)

Actually, I think it's more correct than the trunk's version anyway.

alumae avatar Nov 18 '14 10:11 alumae

Thanks!! On 18 Nov 2014 10:50, "Tanel Alumäe" [email protected] wrote:

This can be solved by recompiling SRILM using the -fPIC flag. To do this, modify SRILM's common/Makefile.machine.i686-m64 (or appropriate for you system) file and add -fPIC to the following lines like that:

ADDITIONAL_CFLAGS = -fopenmp -fPIC ADDITIONAL_CXXFLAGS = -fopenmp -fPIC

Then make clean and make World SRILM.

I also had to modify pysrilm's setup.py a little. I you get errors about undefined symbol: gzvprintf, use the following section in pysrilm's setup.py and try again:

setup( cmdclass = {'build_ext': build_ext}, ext_modules = [ Extension("srilm", ["srilm.pyx"], language="c++", include_dirs=[SRILM_INCLUDE_DIR], libraries=["oolm", "dstruct", "misc", "z", "gomp"], library_dirs=[SRILM_LIB_DIR], extra_compile_args=['-fopenmp', '-fPIC'], ) ], )

Actually, I think it's more correct than the trunk's version anyway.

— Reply to this email directly or view it on GitHub https://github.com/njsmith/pysrilm/issues/4#issuecomment-63452522.

mdtux89 avatar Nov 18 '14 10:11 mdtux89

Thanks a lot! Had the same issue, your solution worked for me!

PeterBourgonje avatar Jul 13 '15 12:07 PeterBourgonje

Solved my problem as well. Thanks.

afshinrahimi avatar Sep 15 '16 01:09 afshinrahimi