Struggling to get scons to work with mingw on windows - c++

Trying to get a test case working so that I can compile C++ using scons.
However I am getting this error:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\Python27\Scripts\scons.py", line 199, in <module>
C:/Qt/Tools/mingw492_32/bin/g++.exe -o test.o -c test.cpp
scons: *** [test.o] Error 1
scons: building terminated because of errors.
Here is my SConstruct at this time:
env = Environment(tools = ["mingw"], TARGET_ARCH=['x86'])
env.Replace(CXX = 'C:/Qt/Tools/mingw492_32/bin/g++.exe')
env.Program("main","test.cpp")
I am confused by the visual studio error, because I have specified that I want to use mingw.

My problem in this case was caused by me using PowerShell for the first time. Which for some reason that I have not yet learned, does not provide popups of error messages. When I used cmd I saw that I had a path issue, and scons was otherwise working fine.

Related

Make error: emmake make results in error when trying to build libxml2, can't find libxml.so.2

My goal is to compile my C program to wasm with emscripten (which I installed via emsdk). It uses libxml2. I am following the steps outlined here https://github.com/kripken/xml.js/blob/master/script/libxml2 to build
libxml2 from source with the appropriate emscripten parameters.
When I run emmake make, I get the following warnings and errors:
...
CCLD libxml2.la
emcc: warning: linking a library with `-shared` will emit a static object file.
This is a form of emulation to support existing build systems.
If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc]
emcc: warning: ignoring unsupported linker flag: `--version-script=./libxml2.syms` [-Wlinkflags]
wasm-ld: error: cannot open libxml2.so.2: No such file or directory
emcc: error: '/home/willy/emsdk/upstream/bin/wasm-ld -o .libs/libxml2.so.2.9.9 .libs/SAX.o .libs/entities.o .libs/encoding.o -L/home/willy/emsdk/upstream/emscripten/system/local/lib .libs/error.o -L/home/willy/emsdk/upstream/emscripten/system/lib .libs/parserInternals.o -L/home/willy/emsdk/upstream/emscripten/cache/wasm .libs/parser.o .libs/tree.o .libs/hash.o .libs/list.o .libs/xmlIO.o .libs/xmlmemory.o .libs/uri.o .libs/valid.o .libs/xlink.o .libs/HTMLparser.o .libs/HTMLtree.o .libs/debugXML.o .libs/xpath.o .libs/xpointer.o .libs/xinclude.o .libs/nanohttp.o .libs/nanoftp.o .libs/catalog.o .libs/globals.o .libs/threads.o .libs/c14n.o .libs/xmlstring.o .libs/buf.o .libs/xmlregexp.o .libs/xmlschemas.o .libs/xmlschemastypes.o .libs/xmlunicode.o .libs/xmlreader.o .libs/relaxng.o .libs/dict.o .libs/SAX2.o .libs/xmlwriter.o .libs/legacy.o .libs/chvalid.o .libs/pattern.o .libs/xmlsave.o .libs/xmlmodule.o .libs/schematron.o .libs/xzlib.o /home/willy/emsdk/upstream/emscripten/cache/wasm/libc.a libxml2.so.2 --relocatable -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (1)
make[2]: *** [Makefile:1065: libxml2.la] Error 1
make[2]: Leaving directory '/home/willy/CWasmSandbox/libxml2-2.9.9'
make[1]: *** [Makefile:1484: all-recursive] Error 1
make[1]: Leaving directory '/home/willy/CWasmSandbox/libxml2-2.9.9'
make: *** [Makefile:897: all] Error 2
The only thing I can gather with my limited understanding of emscripten is that it tries to access libxml2.so.2 which under normal circumstances would be generated from libxml2.la. But libxml2.so.2 was not generated because emscripten does not produce shared objects. Is this assesment correct? I tried passing the option CFLAGS="-s SIDE_MODULE=1" to make, but it didn't fix the error and was probably a stupid idea born from my limited knowledge of build systems. I also tried copying libxml2.so.2 from a previous installation into the appropriate directory, but no luck, and also kind of dumb since emscripten would have no use for .so files? What should my next steps be?
Easiest way is to resign from shared lib.
There is an important limitation with shared one (side module): it will not work if you are going to use threads in your main application.
So just make a change of ./script/libxml2
-emconfigure ../libxml2/configure --with-http=no --with-ftp=no --with-python=no --with-threads=no
+emconfigure ../libxml2/configure --with-http=no --with-ftp=no --with-python=no --with-threads=no --enable-shared=no
Build and link ./build/.libs/libxml2.a with your main application.

Building OpenCV 3.3 using Mingw-make gives error 2 at 47%

When trying to build OpenCV 3.3.0 with the mingw compiler I keep getting an error. First I am using CMake to generate the build files (I choose Mingw makefiles and select the gcc en g++ compilers myself, although using the native compilers gives me the same error at the exact same time). When I then use mingw32-make to build OpenCV I get the following error around 48%:
48%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx.cpp.obj
[ 48%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/convert.avx2.cpp.obj
[ 48%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx2.cpp.obj
[ 48%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/stat.avx2.cpp.obj
[ 48%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
C:\Qt\Tools\mingw530_32\bin\windres.exe: unknown option -- W
Usage: C:\Qt\Tools\mingw530_32\bin\windres.exe [option(s)] [input-file] [output-file]
The options are:
-i --input=<file> Name input file
-o --output=<file> Name output file
-J --input-format=<format> Specify input format
-O --output-format=<format> Specify output format
-F --target=<target> Specify COFF target
--preprocessor=<program> Program to use to preprocess rc file
--preprocessor-arg=<arg> Additional preprocessor argument
-I --include-dir=<dir> Include directory when preprocessing rc file
-D --define <sym>[=<val>] Define SYM when preprocessing rc file
-U --undefine <sym> Undefine SYM when preprocessing rc file
-v --verbose Verbose - tells you what it's doing
-c --codepage=<codepage> Specify default codepage
-l --language=<val> Set language when reading rc file
--use-temp-file Use a temporary file instead of popen to read
the preprocessor output
--no-use-temp-file Use popen (default)
-r Ignored for compatibility with rc
#<file> Read options from <file>
-h --help Print this help message
-V --version Print version information
FORMAT is one of rc, res, or coff, and is deduced from the file name
extension if not specified. A single file name is an input file.
No input-file is stdin, default rc. No output-file is stdout, default rc.
C:\Qt\Tools\mingw530_32\bin\windres.exe: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
modules\core\CMakeFiles\opencv_core.dir\build.make:1641: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj' failed
mingw32-make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
mingw32-make[2]: *** Waiting for unfinished jobs....
CMakeFiles\Makefile2:1550: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
mingw32-make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I am quite the novice when it comes to building a library and for some reason building them always seems to fail with me. Can anyone help me?
-
Martijn
Maybe this answer can help. Its a problem with cmake and precompiled headers
try this : in cmake uncheck ENABLE_PRECOMPILED_HEADERS
If unchecking ENABLE_PRECOMPILED_HEADERS doesn't work. Try this:
Add a new entry to CMake
Name the entry: OPENCV_ALLOCATOR_STATS_COUNTER_TYPE with Value(String): int64_t
Configure and generate the MAKEFILE
Go to the build directory and execute make install or mingw32-make install
If you want more info of your compilation log, you can run make install VERBOSE=1

arm-none-eabi-g++: command not found in Eclipse

I'm attempting to build firmware from a GitHub project, which uses GCC-ARM, SCons, and OpenOCD (I'm using a Mac btw). If I run "scons" from the command line, the project builds just fine.
However, I want to use Eclipse to build the project. I installed "SConsolidator" and "GNU ARM on Eclipse" plugins, and I imported the project as a Scons project. I also went into project Properties -> C/C++ General -> Paths and Symbols and I added the GNU ARM includes directory for GNU C and GNU C++ under the includes tab.
However, when I try to build the project, I get this:
=== Running SCons at 10/5/16 10:04 PM ====
Command line: /usr/local/bin/scons -u --jobs=8
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build/lpc11c14 build/lpc1549 build
CXX build/BMS/src/ADT7470Fan.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/main.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/peripherals.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/pins.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/main.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/peripherals.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/pins.o
sh: arm-none-eabi-g++: command not found
scons: *** [build/BMS/src/ADT7470Fan.o] Error 127
CXX build/Dashboard/src/can_dash.o
scons: *** [build/BMS/src/main.o] Error 127
scons: *** [build/BMS/src/peripherals.o] Error 127
scons: *** [build/BMS/src/pins.o] Error 127
scons: *** [build/Cutoff/src/main.o] Error 127
scons: *** [build/Cutoff/src/peripherals.o] Error 127
scons: *** [build/Cutoff/src/pins.o] Error 127
sh: arm-none-eabi-g++: command not found
scons: *** [build/Dashboard/src/can_dash.o] Error 127
scons: building terminated because of errors.
Duration 9132 ms.
I'm following the instructions on the Github's page, and it works for other people, so I'm not sure what I'm doing wrong. I suspect it has to do with the $PATH not registering for Eclipse, since I added /usr/local/gcc-arm-none-eabi-5_4-2016q3/bin to the $PATH using ~/.bash_profile so "scons" would work in command line.
You may need to enable running 32 bit binaries on your 64 bit userland.
For debian:
dpkg --add-architecture i386
sudo apt-get install libstdc++6:i386

Build error while building Nodejs on Cygwin

I need some help compiling Node source code on cygwin. Every time I try to make the build, it throws the following error message. I am using Windows 8 and Cygwin 1.7.28. I have tried installing YASM. Please help!
python tools/gyp_node -f make
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory '/home/vineet/node-v0.8.22/out'
*LD_LIBRARY_PATH=/home/vineet/node-v0.8.22/out/Release/lib.host:/home/vineet/node-v0.8.22/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/openssl; mkdir -p /home/vineet/node-v0.8.22/out/Release/obj.target/openssl/geni; ml64.exe /Zi /Fo "/home/vineet/node-v0.8.22/out/Release/obj.target/openssl/geni/aes-x86_64.obj" /c "/home/vineet/node-v0.8.22/deps/openssl/asm/x64-win32-masm/aes/aes-x86_64.asm"
/bin/sh: ml64.exe: command not found
deps/openssl/openssl.target.mk:10: recipe for target '/home/vineet/node-v0.8.22/out/Release/obj.target/openssl/geni/aes-x86_64.obj' failed
make[1]: *** [/home/vineet/node-v0.8.22/out/Release/obj.target/openssl/geni/aes-x86_64.obj] Error 127
make[1]: Leaving directory '/home/vineet/node-v0.8.22/out'
Makefile:26: recipe for target 'node' failed
make: *** [node] Error 2*
Well, since it's complaining about ml64, you have to establish:
Do you actually have masm/x64 on your system? It's probably in a directory like C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\
Is your path set up within CygWin to reference that directory, so that the executable can be found?
By the error message:
/bin/sh: ml64.exe: command not found
it's almost certainly one of those two problems.
in fact , you can download a VC++ express from Microsoft, it is free. and just open a VC++ X86 Command Prompt, then simple execute VCbuild.bat, cygwin is useless in this case.

Compiling Festival on MingW32

I'm trying to compile Festival on MingW32, so I can have a Windows binary. I couldn't find the Windows binary on their site. Anyone have one they can post?
If not, here's what I have so far. I did the ./configure and make for it and have the following message:
$ make
config/config:43: ../speech_tools/config/config: No such file or directory
So, I downloaded the speech_tools tar ball and got. Did the ./configure and make to get:
$ make
config/config:156: config/systems/ix86_unknown.mak: No such file or directory
../config/config:156: ../config/systems/ix86_unknown.mak: No such file or directory
make: *** No rule to make target `../config/systems/ix86_unknown.mak'. Stop.
config/rules/modules.mak:133: config/modincludes.inc: No such file or directory
make --no-print-directory -C ./config MADE_FROM_ABOVE=1 MODINCLUDES=1 INCLUDE_EVERYTHING='' modincludes.inc
../config/config:156: ../config/systems/ix86_unknown.mak: No such file or directory
make[1]: *** No rule to make target `../config/systems/ix86_unknown.mak'. Stop.
make: *** [config/modincludes.inc] Error 2
So, I copied config/systems/ix86_CYGWIN32.mak to ix86_unknown.mak and tried again. Now I get this message:
g++ -c -fno-implicit-templates -O3 -Wall -Wno-non-template-friend -Wno-deprecated -DSUPPORT_EDITLINE -I../include slib.cc
In file included from slib.cc:85:
../include/EST_unix.h:53:25: sys/wait.h: No such file or directory
../include/EST_unix.h:54:29: sys/resource.h: No such file or directory
In file included from ../include/EST_String.h:50,
from ../include/siod.h:17,
from slib.cc:88:
../include/EST_iostream.h:54:26: strstream.h: No such file or directory
In file included from ../include/EST_TList.h:50,
from ../include/EST_string_aux.h:43,
from ../include/siod.h:18,
from slib.cc:88:
Where do I get sys/wait.h, sys/resource.h and strstream.h? I'd rather not have to try this whole bit in Cygwin and carry around those annoying DLL's. Any advice?
Windows binaries are available here
You'll get further with a full cygwin install instead of just mingwin, but I can't promise success.
I run Ubuntu and remember having Festival available in the Synaptics repository, implying I just had to double click the name, and the thing installed itself with all its dependencies.
If all else fails, you might want to run a VM with ubuntu or dual boot.