Trouble compiling praat on Windows with cygwin - internal compiler error - c++

I'm attempting to compile Praat (http://www.fon.hum.uva.nl/praat/) with Cygwin. I tried following the instructions on the GitHub page (https://github.com/praat/praat). When I run 'make', several files compile with no problem, but then I get:
x86_64-w64-mingw32-gcc -std=gnu99 -municode -D_FILE_OFFSET_BITS=64 -O1 -I ../../sys -I ../../dwsys -c -o gsl_complex__math.o gsl_complex__math.c
gsl_complex__math.c: In function ‘gsl_complex_log10’:
gsl_complex__math.c:425:3: internal compiler error: Segmentation fault
return gsl_complex_mul_real (gsl_complex_log (a), 1 / log (10.));
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
<builtin>: recipe for target 'gsl_complex__math.o' failed
make[1]: *** [gsl_complex__math.o] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/Colin/workspace/praat-master/external/gsl'
makefile:14: recipe for target 'all' failed
make: *** [all] Error 2
I tried posting a question on the Praat user group with no luck. My suspicion is that it will work with a previous version of x86_64-w64-mingw32-gcc, but I'm not sure how to identify which version will work, or honestly, how to downgrade. (I'm also not sure what the difference is between x86_64-w64-mingw32-gcc and plain ol' gcc.) I'd like to avoid any solution that involves editing the source code because it has clearly been compiled as-is before with no problems.
Any suggestions or pointers is the right direction would be greatly appreciated! :)

Related

Error with linking flag when using the cmake build for cppyy

I am trying to build the example for a make build for cppyy in the cppyy-knearestneighbors example (https://github.com/jclay/cppyy-knearestneighbors-example). From what I understand it used the more modern cppyy cmake.
However when it comes to the linking I find this error,
ld: unknown option: --no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [knn_example/libknn_exampleCppyy.dylib] Error 1
make[1]: *** [CMakeFiles/knn_exampleCppyy.dir/all] Error 2
make: *** [all] Error 2
I couldn't find away to remove this flag as it seems to be something internal to cppyy cmake. Is there any work around to fix the compilation?
I cannot talk about cppyy since I have never used it, but since it internally uses CMake, the issue that you have could control by the value of the LINK_WHAT_YOU_USE property.
I would first try to disable the default value of LINK_WHAT_YOU_USE with:
# When running cmake configure:
cmake -GNinja -DCMAKE_LINK_WHAT_YOU_USE=OFF
If it does not work, a more evolve approach which means iterating all of the targets and unsetting their LINK_WHAT_YOU_USE property. Let me know if you need help for this
https://cmake.org/cmake/help/latest/variable/CMAKE_LINK_WHAT_YOU_USE.html#variable:CMAKE_LINK_WHAT_YOU_USE

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.

Compiling an existing C++ program using Makefile

Edit: not solved, but as I moved on to other software, I ran into other challenges.
For a research project, I downloaded a Github project (Tagliasacchi et al., 2015) for computer vision to Linux 16.04. I have programming experience with PHP but I am new to C++. When I try to replicate the results of the study on my computer, I run early into a compiling error.
The Hello world-example of the Github project (apps » helloworld) works fine.
When trying to compile another application, I run into an error with the Makefile: cmake . works fine and some files are created. However, make does not work.
After the error, g++ [filename].cpp -o main obviously does not work.
How to solve this and get the dependencies right?
In some cases, there is a Makefile, but I run into an error:
[ 33%] Building CXX object CMakeFiles/helloworld_atb.dir/main.cpp.o
/bin/sh: 1: /usr/bin/g++-4.8: not found
CMakeFiles/helloworld_atb.dir/build.make:62: recipe for target 'CMakeFiles/helloworld_atb.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/helloworld_atb.dir/main.cpp.o] Error 127
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/helloworld_atb.dir/all' failed
make[1]: *** [CMakeFiles/helloworld_atb.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
In other cases (e.g. in tracker » HandFinder), I can't run either cmake . or make and compiling using g++ HandFinder.cpp -o handfinder does not work:
In file included from HandFinder.cpp:1:0:
HandFinder.h:2:41: fatal error: tracker/ForwardDeclarations.h: No such file or directory
compilation terminated.

Can someone explain why my cmake file fails to build my cpp file?

So I've got the following CMakeLists.txt file to try and build my main.cpp file.
project(shell)
set(extra_flags = -std=c++11 -Werror -Wall -Wextra)
set(CMAKE_CXX_FLAGS $(CMAKE_CXX_FLAGS) $(extra_flags))
add_executable(shell main.cpp)
At this point, I am just trying to build it with a Hello World program just to make sure everything works. But the flags are there for the rest of the program that I need to write. The actual process of calling cmake . works just fine, but when I use make I get the following error:
[100%] Building CXX object CMakeFiles/shell.dir/main.cpp.o
c++: fatal error: no input files
compilation terminated.
/bin/sh: 1: -o: not found
CMakeFiles/shell.dir/build.make:54: recipe for target 'CMakeFiles/shell.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/shell.dir/main.cpp.o] Error 127
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/shell.dir/all' failed
make[1]: *** [CMakeFiles/shell.dir/all] Error 2
Makefile:72: recipe for target 'all' failed
make: *** [all] Error 2
I'm new to Ubuntu and the command line, so any help would be greatly appreciated.
Make sure you use curly brackets ${} (comment above)
Make sure you delete your CMakeCache.txt if you want a "reset" (comment above)
I also developed the habit to always use set(CMAKE_CXX_FLGAS "${CMAKE_CXX_FLAGS} ${extra_flags}") instead of set(CMAKE_CXX_FLGAS ${CMAKE_CXX_FLAGS} ${extra_flags}) which proved to cause less headache in any of my applications. Try that as well.
Use make VERBOSE=1 to see which commands CMake actually runs. You then can mess with the command directly and see how you get it to work.
If it's just HelloWorld!, try leaving out the -std=c++11 flag (or any flags, really) and see.

Can't build test application with WxWIdgets in Netbeans

I'm a total c++ Newbie.
I'm trying to build windows aplications with Wx-Widgets under Net Beans.
So far so good. I have instaled everything, configured, build wx-widgets and attached it to the new project - with help of a good man here: Can't make wx-widget work with net-beans.
Now I try to build my first app:
#include <wx/string.h>
int main(int argc, char **argv)
{
wxPuts(wxT("A wxWidgets console application"));
}
and this is what I get:
I'm not sure if this is readable so I paste the errors:
g++ `C:\WXWIN\wx-config --cxxflags` -c -g -I../../../WXWIN/include `C:\WXWIN\wx-config --cxxflags` -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
/bin/sh.exe: C:WXWINwx-config: command not found
/bin/sh.exe: C:WXWINwx-config: command not found
In file included from ../../../WXWIN/include/wx/defs.h:21:0,
from ../../../WXWIN/include/wx/string.h:25,
from main.cpp:1:
../../../WXWIN/include/wx/platform.h:196:22: fatal error: wx/setup.h: No such file or directory
compilation terminated.
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/xampp/htdocs/WxWwigets_tutorial'
make[1]: Leaving directory `/c/xampp/htdocs/WxWwigets_tutorial'
BUILD FAILED (exit value 2, total time: 859ms)
Please notice that I have set everything in linker and compiler like ordered: http://wiki.wxwidgets.org/Compiling_using_Netbeans
The error is right in front of you: "command not found". If you use /bin/sh, you must use Unix style paths, e.g. C:/WXWIN/wx-config instead of DOS paths with the backslashes.
I seriously advise you to get familiar with the environment you're using instead of just following the Wiki instructions without understanding them, otherwise your problems won't be over any time soon.