make error 2 on Windows when building fastText - makefile

I'm trying to build fastText (Facebook's library for learning of word representations and sentence classification) and have tried followed the instructions on their Github page:
$ git clone git#github.com:facebookresearch/fastText.git
$ cd fastText
$ make
I installed GnuWin32 and added to the path in order to use the make function. I'm on Windows 10.
However I get the following error:
$ make
c++ -pthread -O3 -funroll-loops -std=c++0x -c src/args.cc
process_begin: CreateProcess(NULL, c++ -pthread -O3 -funroll-loops -std=c++0x -c src/args.cc, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [args.o] Error 2
Anyone has an idea on how to fix this? Thanks!

After posting this question Facebook clarified that FastText only builds on Mac OS and Linux distributions. See https://github.com/facebookresearch/fastText

I encountered similar errors when attempting to build fastText on Windows using MinGW tools. I went instead to use Visual C++ 2015 to build fastText and it worked fine after a few tweaks. I submitted a Pull Request for this change https://github.com/facebookresearch/fastText/pull/39
I also maintain a binary build of fastText for Windows. You can find it at http://cs.mcgill.ca/~mxia3/FastText-for-Windows/
FastText’s authors do not currently support building and running on Windows. There were attempts to run with Bash for Windows and MinGW. This unofficial build is compiled with Visual C++ 2015 to run natively on Windows

Related

Bypass the faulty gcc "-mcygwin" argument, when building a library on python-3.4 on windows, through cygwin

I have the following problem:
I want to build an external library of python on Windows through a script that uses gcc.
When the script reaches the command:
python setup.py build --compiler=cygwin, the following command is generated (that crashes):
C:\cygwin64\bin\gcc.exe -mcygwin -mdll -O -Wall -Inauty -Isrc -IC:\Python34\include -IC:\Python34\include -c src/nautywrap.c -o build\temp.win-amd64-3.4\Release\src\nautywrap.o -O4 -fPIC
One suggestion is whether, I could get rid of the -mcygwin flag and apply other arguments.
(This flag is deprecated -- raises an error:
see gcc-error-unrecognized-command-line-option-mcygwin)
I am using Python 3.4 64-bit (which cannot change..), in a windows_7_x64 environment with cygwin/gcc installed. I can only access the library of the code through the script, so manual code changes, unfortunately, do not offer a solution.
A simple answer could concern the case I could append any arguments by the command:
python setup.py build --compiler=cygwin, in order for ordinary python arguments for the gcc to be omitted and mine to be written on top.

What is causing g++ to produce the error: "ld.exe cannot find -lopencv_world310"?

I am attempting to build an application using g++ that is composed of several source files and also uses OpenCV 3.1.0.
The CMD command is:
g++ -o home_surveillance -static -std=c++11 -m64 -IC:\Tools\OpenCV\opencv\build\include -LC:\Tools\OpenCV\opencv\build\x64\vc14\lib -lopencv_world310 configuration_manager.cpp events.cpp image_processor.cpp main.cpp response_module.cpp scheduler.cpp
The error produced is:
C:/Program Files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lopencv_world310
collect2.exe: error: ld returned 1 exit status
I have been trying various things and searching for answers for a couple days now. I should note that the application builds properly in Visual Studio 2015. I have tried compiling the source files using g++ with the -c option and they all seem to compile fine. It is just the linking phase that produces an error.
Things I have tried:
Just about every possible combination of the specified command. (Modifying order of the options, -lopencv_world310.a, -lopencv_world310.lib, -lopencv_world310, -l"full_path"+"opencv_world310", etc..)
Checked that all the paths and filenames are correct.
Reinstalled mingw to make sure I was using mingw-w64 since this is a 64-bit application.
Running CMD as admin thinking maybe CMD could not access the path specified with -L option.
Googling and reading every post I could find. (Most posts about "ld.exe cannot find "library_name" are a result of someone using "library_name".a or "library_name".lib as input to the -l option).
Reading mingw documentation on the use of GCC/g++ to ensure I wasn't missing anything obvious.
Praying to Bjarne Stroustrup.
Ritual sacrifice involving a Pentium 2.

How to compile jxrlib on windows

I am looking for a library for working with JPEG-XR images and imagemagick refers me to jxrlib provided by Microsoft.
There are no pre-built binaries. The source code comes with a make file, but when I try to build it using GnuMake, I run into errors saying that a .o file was not found.
cc -I. -Icommon/include -Iimage/sys -D__ANSI__ -DDISABLE_PERF_MEASUREMENT -w -O
-Ijxrgluelib -c jxrgluelib/JXRGlue.c
process_begin: CreateProcess(NULL, cc -I. -Icommon/include -Iimage/sys -D__ANSI_
_ -DDISABLE_PERF_MEASUREMENT -w -O -Ijxrgluelib -c jxrgluelib/JXRGlue.c, ...) fa
iled.
make (e=2): The system cannot find the file specified.
make: *** [JXRGlue.o] Error 2
How do I compile this on Windows?
If you happen to have Visual Studio installed, just open the included solution files and build. That has always worked for me. I can't say anything regarding other toolchains under Windows, but I know that it also builds successfully with make and gcc under Ubuntu.
If you can't get it to compile I can share binaries if that helps you.
Visual Studio project files have been added to jxrlib project. See Add vc14 project and solution files commit in the official repository at https://jxrlib.codeplex.com
Alternatively, use CMake configuration proposed here in Patch for warnigns + CMake for building.

Can't make FestVox compile due to missing -leststring and missing libeststring.a

So I have installed / compiled speech_tools, and Festival (2.3) using Cygwin on my Win8.1 machine to the point that I can successfully produce speech using this command:
echo "hello world" | \src\main\festival --tts
The next step is for me to get FestVox running. I have downloaded FestVox 2.6 and I have run ./configure; however, the 'make' step is giving me trouble, producing this error:
gcc -O3 -Wall -o phonealign phonealign_main.o -LC:/cygwin64/Festival/build
/speech_tools/lib -lestools -lestbase -leststring -lncurses -lstdc++ -lm -lwinmm -luser32
/usr/bin/ld: cannot find -leststring
collect2: error: ld returned 1 exit status
Makefile:80: recipe for target 'phonealign' failed
So, I looked at my Makefile at where it might be trying to look for this file, and it looks like in that directory (build\speech_tools\lib) I am missing a libeststring.a partner for my libeststring.lib. Both libestbase and libestools have .lib and .a files in that directory.
At what step did I go wrong?? Should a libeststring.a have been created at some point??? When? How can I fix this?
I think the problem is that you should use compiler in Windows instead of gcc within Cygwin. The role in Cygwin for building Festival is to run configure to generate a Makefile for VC. Then run nmake in Windows command line not make within Cygwin.
Cygwin cannot build a native Windows application like what MINGW does. Application build in Cygwin can only run within Cygwin.
*.a is the static library for Linux, which is built by gcc. *.lib is the static library for Windows, which is built by VC.
So I suggest you taking a look at README, INSTALL files in FestVox. To find whether there is description for make a Makefile for Windows like process "3. Make makefile for VC in Cygwin" in my document (http://www.eguidedog.net/doc_build_win_festival.php)
Cameron

mingw32-make tries to create subfolder .lib an illegal name

I am trying to compile a project that required freetype library so I was figuring out how to install freetype to mingw32 and the more safer way is to compile it.
Anyway the problem was compiling freetype-2.4.11
I went into bash provided in msys
I did ./configure within freetype's main dir and everything looks fine
next I did mingw32-make which created the problem
libtool: compile: gcc -pedantic -ansi -Ig:/Downloads/freetype-2.4.11/objs -I./b
uilds/unix -Ig:/Downloads/freetype-2.4.11/include -c -Wall -g -O2 "-DFT_CONFIG_C
ONFIG_H=<ftconfig.h>" -DFT2_BUILD_LIBRARY "-DFT_CONFIG_MODULES_H=<ftmodule.h>" g
:/Downloads/freetype-2.4.11/src/base/ftsystem.c -DDLL_EXPORT -DPIC -o g:/Downlo
ads/freetype-2.4.11/objs/.libs/ftsystem.o
Assembler messages:
Fatal error: can't create g:/Downloads/freetype-2.4.11/objs/.libs/ftsystem.o: No
such file or directory
g:/Downloads/freetype-2.4.11/builds/freetype.mk:198: recipe for target 'g:/Downl
oads/freetype-2.4.11/objs/ftsystem.lo' failed
mingw32-make[4]: *** [g:/Downloads/freetype-2.4.11/objs/ftsystem.lo] Error 1
g:/Downloads/freetype-2.4.11/objs/.libs/ftsystem.o seemed like it is trying to use a directory that is illegal in windows.
Thanks in advance
Try to use make instead (i.e. the one from MSYS distribution), and avoid using mingw32-make (from MinGW distribution) in the future to save yourself time and nerves. Extract from MinGW Wiki:
What's the difference between make and mingw32-make?
The "native" (i.e.: MSVCRT dependent) port of make is lacking in some functionality and has modified functionality due to the lack of POSIX on Win32. There also exists a version of make in the MSYS distribution that is dependent on the MSYS runtime. This port operates more as make was intended to operate and gives less headaches during execution. Based on this, the MinGW developers/maintainers/packagers decided it would be best to rename the native version so that both the "native" version and the MSYS version could be present at the same time without file name collision.

Resources