Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation problem #4

Open
mdtux89 opened this issue Nov 15, 2014 · 6 comments
Open

Installation problem #4

mdtux89 opened this issue Nov 15, 2014 · 6 comments

Comments

@mdtux89
Copy link

mdtux89 commented Nov 15, 2014

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?

@njsmith
Copy link
Owner

njsmith commented Nov 16, 2014

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
#4.

@mdtux89
Copy link
Author

mdtux89 commented Nov 16, 2014

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
#4.


Reply to this email directly or view it on GitHub
#4 (comment).

@alumae
Copy link

alumae commented Nov 18, 2014

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.

@mdtux89
Copy link
Author

mdtux89 commented Nov 18, 2014

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
#4 (comment).

@PeterBourgonje
Copy link

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

@afshinrahimi
Copy link

Solved my problem as well. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants