njsmith / pysrilm

An extremely simple Python wrapper for the SRI Language Modeling toolkit
BSD 2-Clause "Simplified" License
70 stars 20 forks source link

installation problem - omp.h: No such file or directory #5

Open harashm opened 9 years ago

harashm commented 9 years ago

Hi, I'm trying to install pysrilm using cygwin SRILM had already been compiled.

cmd output:

running install running build running build_ext skipping 'srilm.cpp' Cython extension (up-to-date) building 'srilm' extension C:\Users\harashm\Anaconda\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -IC:\Users\harashm\cygwin\srilm-1.7.1\include -IC:\Users\harashm\Anaconda\include -IC:\Users\harashm\Anaconda\PC -c srilm.cpp -o build\temp.win-amd64-2.7\Release\srilm.o -fopenmp srilm.cpp:239:17: fatal error: omp.h: No such file or directory compilation terminated. error: command 'C:\Users\harashm\Anaconda\Scripts\gcc.bat' failed with exit status 1

What could be the problem? thanks a lot !

njsmith commented 9 years ago

It looks like the Anaconda compiler has broken OpenMP support.

pysrilm doesn't actually need OpenMP support, we just request it b/c other people were reporting that their SRILM was getting compiled with OpenMP by default, and then trying to build pysrilm without OpenMP caused problems b/c of the mismatch.

So the easy thing to try would be to disable OpenMP support by editing setup.py and replacing ['-fopenmp'] with []. If that works, then great! If it doesn't... well, then paste your error and more details on how you compiled SRILM, I guess.

harashm commented 9 years ago

OK, it didn't work. I'm running Win8, anaconda installed. I've compiled SRILM with cygwin, by typing: 'make World', 'make test' (didn't change anything) I'm trying to install pysrilm with windows cmd.

After changing the setup.py file, I got this error:

C:\Users\harashm\cygwin# wrappers\pysrilm>python setup.py install running install running build running build_ext skipping 'srilm.cpp' Cython extension (up-to-date) building 'srilm' extension C:\Users\harashm\Anaconda\Scripts\gcc.bat -DMSWIN64 -mdll -O -Wall -IC:\Users\h arashm\cygwin\srilm-1.7.1\include -IC:\Users\harashm\Anaconda\include -IC:\Users \harashm\Anaconda\PC -c srilm.cpp -o build\temp.win-amd64-2.7\Release\srilm.o In file included from C:\Users\harashm\cygwin\srilm-1.7.1\include/Prob.h:20:0, from C:\Users\harashm\cygwin\srilm-1.7.1\include/LM.h:25, from C:\Users\harashm\cygwin\srilm-1.7.1\include/Ngram.h:16, from srilm.cpp:236: C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h: In function 'const char* countToString(long long unsigned int)': C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:69:37: warning: unknown conversion type character 'l' in format [-Wformat] C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:69:37: warning: too many arguments for format [-Wformat-extra-args] C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h: In function 'Boolean stringToCount(const char, long long unsigned int&)': C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:126:54: warning: unknown conversion type character 'l' in format [-Wformat] C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:126:54: warning: too many arguments for format [-Wformat-extra-args] srilm.cpp: In function 'void __PyxRaiseArgtupleInvalid(const char, int, Py_ssize_t, Py_ssize_t, Py_ssize_t)': srilm.cpp:3053:59: warning: unknown conversion type character 'z' in format [-Wformat] srilm.cpp:3053:59: warning: format '%s' expects argument of type 'char*', but argument 5 has type 'Py_ssize_t {aka long long int}' [-Wformat] srilm.cpp:3053:59: warning: unknown conversion type character 'z' in format [-Wformat] srilm.cpp:3053:59: warning: too many arguments for format [-Wformat-extra-args] writing build\temp.win-amd64-2.7\Release\srilm.def C:\Users\harashm\Anaconda\Scripts\g++.bat -DMS_WIN64 -shared -s build\temp.win-a md64-2.7\Release\srilm.o build\temp.win-amd64-2.7\Release\srilm.def -LC:\Users\h arashm\Anaconda\libs -LC:\Users\harashm\Anaconda\PCbuild\amd64 -loolm -ldstruct -lmisc -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\srilm.pyd c:/users/harashm/anaconda/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../.. /../x86_64-w64-mingw32/bin/ld.exe: cannot find -loolm c:/users/harashm/anaconda/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../.. /../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldstruct c:/users/harashm/anaconda/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../.. /../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmisc collect2.exe: error: ld returned 1 exit status

error: command 'C:\Users\harashm\Anaconda\Scripts\g++.bat' failed with exit status 1

I've tried different 'extra_link_args': extra_link_args=["-L" + SRILM_LIB_DIR, "-liconv"], and extra_link_args=["-L" + SRILM_LIB_DIR, '-lgomp', '-lz'], and another try without this line, didn't work :(

I feel I'm doing something wrong. Do you have any idea?

njsmith commented 9 years ago

Ah... sorry, yeah, this isn't going to work the way you're trying it. Windows gets very cranky about mixing compilers -- generally you have to use the same compiler for everything. And this is especially true for Cygwin, which acts almost like a separate operating system from the rest if windows. So I think you need to either compile srilm with anaconda's compiler, or else switch from anaconda python to cygwin python. On 24 Jan 2015 19:53, "harashm" notifications@github.com wrote:

OK, it didn't work. I'm running Win8, anaconda installed. I've compiled SRILM with cygwin, by typing: 'make World', 'make test' (didn't change anything) I'm trying to install pysrilm with windows cmd. After changing the setup.py file, I got this error:

C:\Users\harashm\cygwin# wrappers\pysrilm>python setup.py install running install running build running build_ext skipping 'srilm.cpp' Cython extension (up-to-date) building 'srilm' extension C:\Users\harashm\Anaconda\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -IC:\Users\h arashm\cygwin\srilm-1.7.1\include -IC:\Users\harashm\Anaconda\include -IC:\Users \harashm\Anaconda\PC -c srilm.cpp -o build\temp.win-amd64-2.7\Release\srilm.o In file included from C:\Users\harashm\cygwin\srilm-1.7.1\include/Prob.h:20:0, from C:\Users\harashm\cygwin\srilm-1.7.1\include/LM.h:25, from C:\Users\harashm\cygwin\srilm-1.7.1\include/Ngram.h:16, from srilm.cpp:236: C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h: In function 'const char* countToString(long long unsigned int)': C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:69:37: warning: unknown conversion type character 'l' in format [-Wformat] C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:69:37: warning: too many arguments for format [-Wformat-extra-args] C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h: In function 'Boolean stringToCount(const char

_, long long unsigned int&)': C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:126:54: warning: unknown co nversion type character 'l' in format [-Wformat] C:\Users\harashm\cygwin\srilm-1.7.1\include/Counts.h:126:54: warning: too many arguments for format [-Wformat-extra-args] srilm.cpp: In function 'void __PyxRaiseArgtupleInvalid(const char, int, Py_ssize_t, Py_ssize_t, Py_ssize_t)': srilm.cpp:3053:59: warning: unknown conversion type character 'z' in format [-Wformat] srilm.cpp:3053:59: warning: format '%s' expects argument of type 'char*', but argument 5 has type 'Py_ssize_t {aka long long int}' [-Wformat] srilm.cpp:3053:59: warning: unknown conversion type character 'z' in format [-Wformat] srilm.cpp:3053:59: warning: too many arguments for format [-Wformat-extra-args] writing build\temp.win-amd64-2.7\Release\srilm.def C:\Users\harashm\Anaconda\Scripts\g++.bat -DMS_WIN64 -shared -s build\temp.win-a md64-2.7\Release\srilm.o build\temp.win-amd64-2.7\Release\srilm.def -LC:\Users\h arashm\Anaconda\libs -LC:\Users\harashm\Anaconda\PCbuild\amd64 -loolm -ldstruct -lmisc -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\srilm.pyd

c:/users/harashm/anaconda/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../.. /../x86_64-w64-mingw32/bin/ld.exe: cannot find -loolm

c:/users/harashm/anaconda/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../.. /../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldstruct

c:/users/harashm/anaconda/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../.. /../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmisc collect2.exe: error: ld returned 1 exit status error: command 'C:\Users\harashm\Anaconda\Scripts\g++.bat' failed with exit status 1

I've tried different 'extra_link_args': extra_link_args=["-L" + SRILM_LIB_DIR, "-liconv"], and extra_link_args=["-L" + SRILM_LIB_DIR, '-lgomp', '-lz'], and another try without this line, didn't work :(

I feel I'm doing something wrong. Do you have any idea?

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