bootphon / wordseg

A Python toolbox for text based word segmentation
https://docs.cognitive-ml.fr/wordseg
GNU General Public License v3.0
16 stars 7 forks source link

Windows build: dpseg error #6

Closed cainesap closed 7 years ago

cainesap commented 7 years ago

Hello, My student is trying to build on Windows (all has worked fine for me on Mac OS, but I only had to follow your online instructions, and don't know Windows well enough to solve this problem). She has unpacked Boost 1_65_1 (current version) and runs "python setup.py build" for wordseg. It goes as far as creating 'build/lib/wordseg/algos', copies the *.py files from 'wordseg/algos', but fails at 'dpseg': "compiling C++ dependencies for dpseg in build\dpseg" "Error: [WinError 2] The system cannot find the file specified" This is presumably a problem in finding boost? She has tried "set BOOST_ROOT=C:\Program Files\boost\boost_1_65_1" in advance, but with the same outcome. Does anyone know how to solve this problem? thanks in advance

mmmaat commented 7 years ago

Hello !

I don't know Windows very well... But there is a Linux subsytem for Windows your student can try?

Or she can install wordseg within a conda virtual environment, a cross-platform python manager, because it can install boost on windows just with a conda install boost...

Hope it helps! Mathieu

cainesap commented 7 years ago

Many thanks Mathieu! I have forwarded this information and will add a 'thumbs up' if it works, or maybe come back to you if it doesn't.. Andrew

cainesap commented 7 years ago

Hi Mathieu, She has installed a Linux subsystem (Ubuntu) for Windows, cloned the wordseg repository, installed dependencies, run 'python3 setup.py build', and encountered the following error: "compiling C++ dependencies for dpseg in build/dpseg" "Makefile:44 mixed implicit and normal rules: deprecated syntax" "make: No rule to make target 'src/%.cc', needed by '/path/to/directory'. Stop." I think this means that it finds boost ok but there is still a problem with dpseg. I didn't encounter this problem with a build on Mac OS so assume this is Ubuntu-specific. Do you know what I can suggest to fix the problem? many thanks in advance, Andrew

mmmaat commented 7 years ago

Well... this seems to be a syntax error in the dpseg Makefile. I guess this is because there are spaces in the BUILDDIR variable. I updated it to solve that issue, can you have a try and let me know?

If the compilation complains about boost_program_options, just have a sudo apt-get install libboost-program-options-dev. I also updated the doc with that.

cainesap commented 7 years ago

Thank you again Mathieu. Yes she updated and the error is as follows: g++: error: wordseg/build/dpseg/Data.o: No such file or directory Is this the point when we go to libbost-programs-options-dev ? regards, Andrew

mmmaat commented 7 years ago

Can I have the full output of the command please ? And also the list of files in wordseg/build/dpseg ?

For me the setup output is:

mathieu@pasteque:~/lscp/dev/wordseg_test$ python3 setup.py build
zip_safe flag not set; analyzing archive contents...

Installed /home/mathieu/lscp/dev/wordseg_test/.eggs/pytest_runner-2.12.1-py3.6.egg
running build
running build_py
creating build
creating build/lib
creating build/lib/wordseg
copying wordseg/folding.py -> build/lib/wordseg
copying wordseg/__init__.py -> build/lib/wordseg
copying wordseg/prepare.py -> build/lib/wordseg
copying wordseg/utils.py -> build/lib/wordseg
copying wordseg/evaluate.py -> build/lib/wordseg
copying wordseg/separator.py -> build/lib/wordseg
copying wordseg/statistics.py -> build/lib/wordseg
creating build/lib/wordseg/algos
copying wordseg/algos/tp.py -> build/lib/wordseg/algos
copying wordseg/algos/__init__.py -> build/lib/wordseg/algos
copying wordseg/algos/dibs.py -> build/lib/wordseg/algos
copying wordseg/algos/puddle.py -> build/lib/wordseg/algos
copying wordseg/algos/dpseg.py -> build/lib/wordseg/algos
compiling C++ dependencies for dpseg in build/dpseg
g++ -o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Data.o -c src/Data.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include
g++ -o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Estimators.o -c src/Estimators.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include
g++ -o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Scoring.o -c src/Scoring.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include
g++ -o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Sentence.o -c src/Sentence.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include
g++ -o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/dpseg.o -c src/dpseg.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include
g++ -o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/dpseg /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Data.o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Estimators.o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Scoring.o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/Sentence.o /home/mathieu/lscp/dev/wordseg_test/build/dpseg/dpseg.o -lboost_program_options

And the resulting build directory is:

mathieu@pasteque:~/lscp/dev/wordseg_test$ ls build/dpseg/
Data.o  dpseg  dpseg.o  Estimators.o  Scoring.o  Sentence.o
cainesap commented 7 years ago

Hi Mathieu,

The output of setup build is:

Emma@EMMA-PC:/mnt/c/Users/Emma/Documents/0School work/0Uni/wordseg$ python3 setup.py build
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
zip_safe flag not set; analyzing archive contents...
Installed /mnt/c/Users/Emma/Documents/0School work/0Uni/wordseg/.eggs/pytest_runner-2.12.1-py3.5.egg
running build
running build_py
creating build
creating build/lib
creating build/lib/wordseg
copying wordseg/evaluate.py -> build/lib/wordseg
copying wordseg/folding.py -> build/lib/wordseg
copying wordseg/prepare.py -> build/lib/wordseg 
copying wordseg/separator.py -> build/lib/wordseg 
copying wordseg/statistics.py -> build/lib/wordseg
copying wordseg/utils.py -> build/lib/wordseg   
copying wordseg/__init__.py -> build/lib/wordseg 
creating build/lib/wordseg/algos
copying wordseg/algos/dibs.py -> build/lib/wordseg/algos  
copying wordseg/algos/dpseg.py -> build/lib/wordseg/algos
copying wordseg/algos/puddle.py -> build/lib/wordseg/algos
copying wordseg/algos/tp.py -> build/lib/wordseg/algos       
copying wordseg/algos/__init__.py -> build/lib/wordseg/algos
compiling C++ dependencies for dpseg in build/dpseg       
g++ -o /mnt/c/Users/Emma/Documents/0School work/0Uni/wordseg/build/dpseg/Data.o -c src/Data.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include    
g++: error: work/0Uni/wordseg/build/dpseg/Data.o: No such file or directory 
Makefile:45: recipe for target 'Data.o' failed          
make: *** [Data.o] Error 1 

And the directory listing is empty:

Emma@EMMA-PC:/mnt/c/Users/Emma/Documents/0School work/0Uni/wordseg$ ls build/dpseg   
mmmaat commented 7 years ago

Ok thanks, the issue is the space in the directory 0School work (on linux we used to have 0School_work instead).

I reproduced your bug, modified the setup procedure and fixed it. So it should work now!!

mmmaat commented 7 years ago

By the way for the next release (see the branch wordseg-ag) I completely rewrote the setup procedure to use CMake, a more flexible and powerfull tool for building.

cainesap commented 7 years ago

Thank you Mathieu!

That does indeed improve things, but there's still an error on dpseg, like below, but also there are files in build/dpseg now..

Emma@EMMA-PC:/mnt/c/Users/Emma/Documents/0School/0Uni/wordseg$ python3 setup.py build
...
compiling C++ dependencies for dpseg in build/dpseg                                                                     
g++ -o ../../../build/dpseg/Data.o -c src/Data.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include                            
g++ -o ../../../build/dpseg/Estimators.o -c src/Estimators.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include                 
g++ -o ../../../build/dpseg/Scoring.o -c src/Scoring.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include                      
g++ -o ../../../build/dpseg/Sentence.o -c src/Sentence.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include                    
g++ -o ../../../build/dpseg/dpseg.o -c src/dpseg.cc -Wall -O3 -std=c++11 -DNDEBUG -I./include                          
g++ -o ../../../build/dpseg/dpseg ../../../build/dpseg/Data.o ../../../build/dpseg/Estimators.o ../../../build/dpseg/Scoring.o ../../../build/dpseg/Sentence.o ../../../build/dpseg/dpseg.o -lboost_program_options                            
/usr/bin/ld: cannot find -lboost_program_options                                                                       
collect2: error: ld returned 1 exit status                                                                              
Makefile:45: recipe for target 'dpseg' failed                                                                          
make: *** [dpseg] Error 1
Emma@EMMA-PC:/mnt/c/Users/Emma/Documents/0School/0Uni/wordseg$ ls build/dpseg                                          
Data.o  dpseg.o  Estimators.o  Scoring.o  Sentence.o 
mmmaat commented 7 years ago

The issue is /usr/bin/ld: cannot find -lboost_program_options

Just have a sudo apt-get install libboost-program-options-dev it should work.

cainesap commented 7 years ago

Thank you very much Mathieu! It all works now :)