Cannot compile insight debugger on mingw64 - c++

I am trying to compile insight from source (git://sourceware.org/git/insight.git) on mingw64 (x86_64-w64-mingw32-gcc).
These are my ./configure options:
./configure --prefix=/opt/arm-none-eabi-insight --target=arm-none-eabi --disable-binutils --disable-elfcpp --disable-gas --disable-gold --disable-gprof --disable-ld --disable-rpath --disable-zlib --enable-sim --with-expat --with-python --without-libunwind --with-tcl=/mingw64/lib --with-tk=/mingw64/lib
make output error:
[...]
CXX gdbtk/generic/gdbtk-bp.o
CXX gdbtk/generic/gdbtk-cmds.o
gdbtk/generic/gdbtk-cmds.c: In function 'int gdb_listfiles(ClientData, Tcl_Interp*, int, Tcl_Obj* const*)':
gdbtk/generic/gdbtk-cmds.c:1213:25: error: cannot convert 'listfiles_info' to 'void (*)(const char*, const char*, void*)'
1213 | map_symbol_filenames (info, false);
| ^~~~
| |
| listfiles_info
In file included from gdbtk/generic/gdbtk-cmds.c:33:
./symfile.h:546:51: note: initializing argument 1 of 'void map_symbol_filenames(void (*)(const char*, const char*, void*), void*, int)'
546 | void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~
make[3]: *** [Makefile:1629: gdbtk/generic/gdbtk-cmds.o] Error 1
make[3]: Leaving directory '/d/Work/FC/build_insight/insight/bundle/gdb'
make[2]: *** [Makefile:10110: all-gdb] Error 2
make[2]: Leaving directory '/d/Work/FC/build_insight/insight/bundle'
make[1]: *** [Makefile:866: all] Error 2
make[1]: Leaving directory '/d/Work/FC/build_insight/insight/bundle'
make: *** [Makefile:4: notarget] Error 2
How can I disable the gtk component? I have tried ./configure with --disable-gtk but no success.

Related

error: could not convert ‘print’ from ‘void (*)(int)’ to ‘std::function<void()>’

Following on from a previous question, I was pointed to an answer. The answer however involved a lambda function and I am trying to pass a normal function through.
Using the below code as an example:
#include <iostream>
#include <functional>
void forloop(std::function<void()> func, int arg) {
func(arg);
}
void print(int number) {
std::cout << number << std::endl;
}
int main() {
int n = 5;
forloop(print, n);
}
The following error is returned in CLion.
/home/dave/JetBrains/CLion/bin/cmake/bin/cmake --build /home/dave/CLionProjects/csv/cmake-build-debug --target csv -- -j 2
Scanning dependencies of target csv
[ 50%] Building CXX object CMakeFiles/csv.dir/main.cpp.o
/home/dave/CLionProjects/csv/main.cpp: In function ‘void forloop(std::function<void()>, int)’:
/home/dave/CLionProjects/csv/main.cpp:5:13: error: no match for call to ‘(std::function<void()>) (int&)’
func(arg);
^
In file included from /home/dave/CLionProjects/csv/main.cpp:2:0:
/usr/include/c++/6/functional:2122:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = void; _ArgTypes = {}]
function<_Res(_ArgTypes...)>::
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6/functional:2122:5: note: candidate expects 0 arguments, 1 provided
/home/dave/CLionProjects/csv/main.cpp: In function ‘int main()’:
/home/dave/CLionProjects/csv/main.cpp:16:21: error: could not convert ‘print’ from ‘void (*)(int)’ to ‘std::function<void()>’
forloop(print, n);
^
CMakeFiles/csv.dir/build.make:62: recipe for target 'CMakeFiles/csv.dir/main.cpp.o' failed
make[3]: *** [CMakeFiles/csv.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/csv.dir/all' failed
make[2]: *** [CMakeFiles/csv.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/csv.dir/rule' failed
make[1]: *** [CMakeFiles/csv.dir/rule] Error 2
Makefile:118: recipe for target 'csv' failed
make: *** [csv] Error 2
Apologies if this questions seems silly - I am a C++ noob.
std::function<void()> means "function that returns void and takes no arguments". You're trying to pass print instead, which is a "function that returns void and takes an int". The types are mismatched.
Change forloop to:
void forloop(std::function<void(int)> func, int arg) { /* ... */ }
Also, don't use std::function to pass lambdas unless you have a good reason to do so. I suggest reading my article on the subject: "passing functions to functions".

OpenCV in Cygwin - make: *** [Makefile:128: all] Error 2

I'm trying to install OpenCV on my Windows, using cygwin, using these commands :
cd ~
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 2.4.5
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make -j8
sudo make install
The Problem is after i try to use command: "make -j8" , i get this error at around 67% :
[ 67%] Building CXX object modules/legacy/CMakeFiles/opencv_legacy.dir/src/calibfilter.cpp.o
/cygdrive/d/newbuild/opencv/modules/legacy/src/calibfilter.cpp: In member function ‘virtual bool CvCalibFilter::SaveCameraParams(const char*)’:
/cygdrive/d/newbuild/opencv/modules/legacy/src/calibfilter.cpp:689:47: error: ‘CvStereoCamera {aka struct CvStereoCamera}’ has no member named ‘quad’
fprintf(f, "%15.10f ", stereo.quad[i][j].x );
^
/cygdrive/d/newbuild/opencv/modules/legacy/src/calibfilter.cpp:690:47: error: ‘CvStereoCamera {aka struct CvStereoCamera}’ has no member named ‘quad’
fprintf(f, "%15.10f ", stereo.quad[i][j].y );
^
/cygdrive/d/newbuild/opencv/modules/legacy/src/calibfilter.cpp: In member function ‘virtual bool CvCalibFilter::LoadCameraParams(const char*)’:
/cygdrive/d/newbuild/opencv/modules/legacy/src/calibfilter.cpp:746:57: error: ‘CvStereoCamera {aka struct CvStereoCamera}’ has no member named ‘quad’
int values_read = fscanf(f, "%f ", &(stereo.quad[i][j].x) );
^
/cygdrive/d/newbuild/opencv/modules/legacy/src/calibfilter.cpp:748:53: error: ‘CvStereoCamera {aka struct CvStereoCamera}’ has no member named ‘quad’
values_read = fscanf(f, "%f ", &(stereo.quad[i][j].y) );
^
make[2]: *** [modules/legacy/CMakeFiles/opencv_legacy.dir/build.make:639: modules/legacy/CMakeFiles/opencv_legacy.dir/src/calibfilter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4703: modules/legacy/CMakeFiles/opencv_legacy.dir/all] Error 2
make: *** [Makefile:128: all] Error 2
How do I solve this problem? I already tried using "make" instead of "make -j"
there is no difference
EDIT: I want to use the specific 2.4.5 version of OpenCV

Cassandra cpp-driver compile error

I'm trying to install Cassandra cpp-driver in Ubuntu.
I've done the steps specified in DataStax C/C++ Driver for Apache Cassandra (Beta), but i keep getting the following compile error.
[ 1%] Building CXX object CMakeFiles/cassandra.dir/src/buffer_collection.cpp.o
In file included from /root/libraries/cass_cpp-driver/git2/cpp-driver/src/session.hpp:29:0, from /root/libraries/cass_cpp-driver/git2/cpp-driver/src/types.hpp:22, from /root/libraries/cass_cpp-driver/git2/cpp-driver/src/buffer_collection.cpp:19:
/root/libraries/cass_cpp-driver/git2/cpp-driver/src/logger.hpp: In member function 'int cass::Logger::init()':
/root/libraries/cass_cpp-driver/git2/cpp-driver/src/logger.hpp:40:59: error: no matching function for call to 'cass::AsyncQueue<cass::MPMCQueue<cass::Logger::LogMessage*> >::init(uv_loop_t*, cass::Logger* const, void (&)(uv_async_t*, int))'
int init() { return log_queue_.init(loop(), this, on_log); }
^
/root/libraries/cass_cpp-driver/git2/cpp-driver/src/logger.hpp:40:59: note: candidate is:
In file included from /root/libraries/cass_cpp-driver/git2/cpp-driver/src/event_thread.hpp:21:0,
from /root/libraries/cass_cpp-driver/git2/cpp-driver/src/session.hpp:20,
from /root/libraries/cass_cpp-driver/git2/cpp-driver/src/types.hpp:22,
from /root/libraries/cass_cpp-driver/git2/cpp-driver/src/buffer_collection.cpp:19:
/root/libraries/cass_cpp-driver/git2/cpp-driver/src/async_queue.hpp:34:7: note: int cass::AsyncQueue<Q>::init(uv_loop_t*, void*, uv_async_cb) [with Q = cass::MPMCQueue<cass::Logger::LogMessage*>; uv_loop_t = uv_loop_s; uv_async_cb = void (*)(uv_async_s*); uv_async_t = uv_async_s] <near match>
int init(uv_loop_t* loop, void* data, uv_async_cb async_cb) {
^
/root/libraries/cass_cpp-driver/git2/cpp-driver/src/async_queue.hpp:34:7: note: no known conversion for argument 3 from 'void(uv_async_t*, int) {aka void(uv_async_s*, int)}' to 'uv_async_cb {aka void (*)(uv_async_s*)}'
make[2]: *** [CMakeFiles/cassandra.dir/src/buffer_collection.cpp.o] Error 1
make[1]: *** [CMakeFiles/cassandra.dir/all] Error 2
make: *** [all] Error 2
I've already fixed this compile errors in Cassandra cpp-driver, by down-versioning libuv to version libuv-0.10, the compile errors will be gone.
It seems that the latest updates for libuv is not yet supported by Cassandra cpp-driver.

error: no match for ‘operator+’ in ‘boost::filesystem::path::filename() const() + "/"’

I'm working with this source but I get this error:
In file included from /usr/include/boost/filesystem.hpp:15:0,
[LIST=1]
from luascript.cpp:21:
/usr/include/boost/filesystem/config.hpp:16:5: error: #error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
luascript.cpp: In member function ‘bool LuaInterface::loadDirectory(const string&, Npc*, bool)’:
luascript.cpp:745:61: error: no match for ‘operator+’ in ‘boost::filesystem::path::filename() const() + "/"’
make[1]: *** [luascript.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/dv/src.DEB'
make: *** [all] Error 2
[/LIST]
With this section of code:
if(boost::filesystem::is_directory(it->status()))
{
if(recursively && !loadDirectory(it->path().filename() + "/" + s, npc, recursively))
return false;
}
You want
if(recursively && !loadDirectory(it->path() / s, npc, recursively))
return false;
It's shorter, more elegant, optimized for allocations and platform-independent!
IMO this one the rarer cases where non-traditional operator overloading works really well to achieve "instant" intuitive eDSL in C++ :)

Static compilation of Qt 5 fails under mingw with reference to off64_t

I tried to make static qt, and got error during mingw-make. This is text of error.
static\qhttpnetworkreply.o access\qhttpnetworkreply.cpp
In file included from ..\..\mkspecs\win32-g++/qplatformdefs.h:56:0,
from access\qhttpnetworkreply_p.h:55,
from access\qhttpnetworkreply.cpp:42:
c:\mingw\include\io.h:301:14: error: 'off64_t' does not name a type
__CRT_INLINE off64_t lseek64 (int, off64_t, int);
^
c:\mingw\include\io.h:302:14: error: 'off64_t' does not name a type
__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) {
^
Makefile.Debug:8214: recipe for target '.obj/debug_static/qhttpnetworkreply.o' f ailed
mingw32-make[3]: *** [.obj/debug_static/qhttpnetworkreply.o] Error 1
mingw32-make[3]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/network'
Makefile:38: recipe for target 'debug-all' failed
mingw32-make[2]: *** [debug-all] Error 2
mingw32-make[2]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/network'
Makefile:182: recipe for target 'sub-network-make_first' failed
mingw32-make[1]: *** [sub-network-make_first] Error 2
mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src'
Makefile:41: recipe for target 'sub-src-make_first' failed
mingw32-make: *** [sub-src-make_first] Error 2
C:\Qt\Qt5.1.1\5.1.1\Src\qtbase>
I use windows 8.1. I follow steps from one instructions.
it is some bug in MinGW, when one of -ansi, -std=c++11, -std=c++03 and -std=c++98 are used.
in file {MinGW dir}/include/io.h replace
__CRT_INLINE off64_t lseek64 (int, off64_t, int);
__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) {
with
__CRT_INLINE _off64_t lseek64 (int, _off64_t, int);
__CRT_INLINE _off64_t lseek64 (int fd, _off64_t offset, int whence) {