Trouble building wxwidget - cmake

I've been trying to build wxwidget 3.1.5 on Windows 10 using CMake.
I simply used the command recommended on the official website:
cmake -G "MinGW Makefiles" ..\wxWidgets-3.1.5\ -DwxBUILD_TESTS=ALL
cmake --build .
It went smoothly until a message popped up
[100%] Building CXX object tests/headers/CMakeFiles/test_headers.dir/__/__/__/__/tests/allheaders.cpp.obj
In file included from D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/platform.h:343,
from D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/defs.h:45,
from D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/wxprec.h:12,
from D:\tools\wxwidget\wxWidgets-3.1.5\tests\testprec.h:4,
from D:\tools\wxwidget\wxWidgets-3.1.5\tests\allheaders.cpp:433:
D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/wxcrtbase.h:228:39: error: redundant redeclaration of 'size_t wcsnlen(const wchar_t*, size_t)' in same scope [-Werror=redundant-decls]
228 | wxDECL_FOR_MINGW32_ALWAYS(size_t, wcsnlen, (const wchar_t*, size_t))
Anybody knows how to cope with it? Thanks in advance!

WxWidgets already provides makefile for you. All you need to do is use it 😀:
cd WxWidgets-3.1.5\build\msw
mingw32-bin.exe -f makefile.gcc BUILD=debug

Related

How to fix Cmake installation error in Open3d? [duplicate]

I'm following this tutorial for building GLFW on Windows, and I'm getting the error when running cmake -S . -B Build:
PS ~\glfw-3.3.2\GLFW> cmake -S . -B Build
CMake Error at CMakeLists.txt:3 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
-- Configuring incomplete, errors occurred!
See also "~/glfw-3.3.2/GLFW/Build/CMakeFiles/CMakeOutput.log".
Output log is almost completely empty containing only one line with my windows version.
I haven't found any discussions or problems matching mine. And I don't even know does nmake have -? flag since it's not listed on microsoft docs site.
I've tried positioning in other folder because maybe that's the case. But with no luck.
I tried solving it with other error solution's but to no avail.
The solution was to append -G "MinGW Makefiles" to cmake -S . -B Build command. As Tsyvarev suggested I looked more into generators and found out that setting the flags doesn't imply which generator will be used. So manually setting the flags solved the problem for me.
The error is about absent nmake utility, which is a build tool for CMake projects configured with "NMake Makefiles" generator.
You need either to install nmake, or specify (with -G option) other generator, which is available on your platform (Windows) and for which you have a built tool. Possible selection of other generators includes e.g. "MinGW Makefiles" and "Visual Studio" family.

cmake on Android (NDK): meaning of -D?

I use NDK and cmake for my Android app. Typical cmake commande is like this:
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86 -DANDROID_PLATFORM=android-24
I wonder what is the meaning of the -D ?
Does cmake commands work without -D ?
cmake -CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -ANDROID_ABI=x86 -ANDROID_PLATFORM=android-24
What is the impact on the final build?
Thanks

Installing LLReve using Cmake. Unknown BISON_TARGET error

I am getting the following error :
CMake Error at CMakeLists.txt:9 (BISON_TARGET):
Unknown CMake command "BISON_TARGET".
when I run the command :
cmake .. -GNinja
Please tell me what to do. I tried searching on google a lot and thus came up with the additions and finally ran the command :
cmake .. -D LLVM_DIR=/usr/lib/llvm-5.0/cmake/ -D FLEX_EXECUTABLE=/usr/local/Cellar/flex/2.5.37/bin/ -D FLEX_INCLUDE_DIR=/usr/local/Cellar/flex/2.5.37/include/ -D BISON_EXECUTABLE=/usr/bin/bison
but it still shows the same error :(.
Please someone help.
Your error is occurring because the BISON_TARGET function definition has not yet been supplied. This method, as commented, is supplied by FindBISON. The error indicates that either Bison was not found on your system (hopefully, you have it installed), or cmake was ran from the wrong directory. Bison is included in the top-level CMake file via:
find_package(BISON REQUIRED)
This line to include Bison must be called before using the BISON_TARGET CMake function. The LLReve instructions for compiling this repository are explicit about which directory to run the build commands in:
Go to the llreve directory and run
cd reve
mkdir build
cd build
cmake .. -GNinja
ninja
This would run on the CMake file in the llreve/reve directory, not the llreve/reve/reve directory. Please ensure you are running CMake from the correct location, as not running cmake on the top-level CMake file will often yield errors.

llvm cmake add_llvm_loadable_module unknown

I am an llvm beginner. I compiled llvm which checked from svn, and I got the error: unknown cmake command add_llvm_loadable_module when using cmake to create a makefile in llvmroot/lib/Transform/Hello/build. I have no idea why this occur. Is there something wrong when compiling llvm? In this case, I compiled llvm by cmake -G "Unix Makefiles" in macros. Thanks for your help.
You just mixed things up.
You should cd into ~/llvm/build and run cmake ~/llvm or cmake ... And you don't need -DCMAKE_PREFIX_PATH at all in this case.
This command will just generate build files for you. Now, if you want to build only that Hello pass instead of whole LLVM, run make help | grep Hello to find out how the corresponding target is called and then make <target>.
You should used add_llvm_library in CMakeLists.txt
like this:
add_llvm_library(My_Plugin MODULE My_Plugin.cpp PLUGIN_TOOL clang)

qgis link error because of libgeos.so

When I try to build qgis-2.8.1 for arm on linux with cmake, I get the error below:
Linking CXX shared module ../../../output/lib/qgis/plugins/libspatialiteprovider.so
[ 54%] Built target spatialiteprovider
Scanning dependencies of target crssync
[ 54%] Building CXX object src/crssync/CMakeFiles/crssync.dir/main.cpp.o
Linking CXX executable ../../output/bin/crssync
/home/lib/trunk/qgis/../geos/geos-3.3.9-imx53-shared/lib/libgeos_c.so: undefined reference to `std::auto_ptr<geos::geom::Envelope>::auto_ptr(std::auto_ptr_ref<geos::geom::Envelope>)'
/home/lib/trunk/qgis/../geos/geos-3.3.9-imx53-shared/lib/libgeos_c.so: undefined reference to `_ZNSt8auto_ptrIN4geos4geom8EnvelopeEEcvSt12auto_ptr_refIT_EIS2_EEv'
I tried to build qgis with this configuration:
cmake -G "Unix Makefiles"
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_INSTALL_PREFIX=/home/lib/trunk/qgis/qgis-2.8.1-imx53-shared
-DCMAKE_BUILD_TYPE=RELEASE
-DENABLE_TESTS=NO
-DWITH_POSTGRESQL=NO
-DWITH_GRASS=NO
-DWITH_PY_COMPILE=NO
-DWITH_BINDINGS=NO
-DENABLE_QT5=NO
-DWITH_QWTPOLAR=TRUE
-DWITH_QSPATIALITE=FALSE
-DWITH_PYSPATIALITE=FALSE
-DPROJ_INCLUDE_DIR=/home/lib/trunk/qgis/../proj/proj-4.8.0-imx53-shared/include
-DPROJ_LIBRARY=/home/lib/trunk/qgis/../proj/proj-4.8.0-imx53-shared/lib/libproj.so
-DGEOS_CONFIG=/home/lib/trunk/qgis/../geos/geos-3.3.9-imx53-shared/bin/geos-config
-DGEOS_INCLUDE_DIR=/home/lib/trunk/qgis/../geos/geos-3.3.9-imx53-shared/include
-DGEOS_LIBRARY=/home/lib/trunk/qgis/../geos/geos-3.3.9-imx53-shared/lib/libgeos_c.so;/home/lib/trunk/qgis/../geos/geos-3.3.9-imx53-shared/lib/libgeos.so
-DGDAL_CONFIG=/home/lib/trunk/qgis/../gdal/gdal-1.11.2-imx53-shared/bin/gdal-config
-DGDAL_INCLUDE_DIR=/home/lib/trunk/qgis/../gdal/gdal-1.11.2-imx53-shared/include
-DGDAL_LIBRARY=/home/lib/trunk/qgis/../gdal/gdal-1.11.2-imx53-shared/lib/libgdal.so;/home/lib/trunk/qgis/../libpng/libpng-1.6.3-imx53-shared/lib/libpng.so;/home/lib/trunk/qgis/../libjpeg/jpeg-6b-imx53-shared/lib/libjpeg.so;/home/lib/trunk/qgis/../libxml2/libxml2-2.7.8-imx53-shared/lib/libxml2.so
-DGSL_CONFIG=/home/lib/trunk/qgis/../gsl/gsl-1.9-imx53-shared/bin/gsl-config
-DGSL_INCLUDE_DIR=/home/lib/trunk/qgis/../gsl/gsl-1.9-imx53-shared/include
-DGSL_LIBRARY=/home/lib/trunk/qgis/../gsl/gsl-1.9-imx53-shared/lib/libgsl.so;/home/lib/trunk/qgis/../gsl/gsl-1.9-imx53-shared/lib/libgslcblas.so
-DSQLITE3_INCLUDE_DIR=/home/lib/trunk/qgis/../sqlite3/sqlite-3080803-imx53-shared/include
-DSQLITE3_LIBRARY=/home/lib/trunk/qgis/../sqlite3/sqlite-3080803-imx53-shared/lib/libsqlite3.so
-DSPATIALITE_INCLUDE_DIR=/home/lib/trunk/qgis/../libspatialite/libspatialite-4.2.0-imx53-shared/include
-DSPATIALITE_LIBRARY=/home/lib/trunk/qgis/../libspatialite/libspatialite-4.2.0-imx53-shared/lib/libspatialite.so;/home/lib/trunk/qgis/../libspatialite/libspatialite-4.2.0-imx53-shared/lib/mod_spatialite.so;/home/lib/trunk/qgis/../sqlite3/sqlite-3080803-imx53-shared/lib/libsqlite3.so;/home/lib/trunk/qgis/../libiconv/libiconv-1.14-imx53-shared/lib/libcharset.so;/home/lib/trunk/qgis/../libiconv/libiconv-1.14-imx53-shared/lib/libiconv.so
-DSPATIALINDEX_INCLUDE_DIR=/home/lib/trunk/qgis/../spatialindex/spatialindex-1.7.0-imx53-shared/include
-DSPATIALINDEX_LIBRARY=/home/lib/trunk/qgis/../spatialindex/spatialindex-1.7.0-imx53-shared/lib/libspatialindex.so;/home/lib/trunk/qgis/../spatialindex/spatialindex-1.7.0-imx53-shared/lib/libspatialindex_c.so
-DEXPAT_INCLUDE_DIR=/home/lib/trunk/qgis/../expat/expat-2.1.0-imx53-shared/include
-DEXPAT_LIBRARY=/home/lib/trunk/qgis/../expat/expat-2.1.0-imx53-shared/lib/libexpat.so
-DQWT_INCLUDE_DIR=/home/lib/trunk/qgis/../qwt/qwt-6.1.1-emb_imx53-shared/include
-DQWT_LIBRARY=/home/lib/trunk/qgis/../qwt/qwt-6.1.1-emb_imx53-shared/lib/libqwt.so;/home/lib/trunk/qgis/../qwt/qwt-6.1.1-emb_imx53-shared/lib/libqwtmathml.so
-DQWTPOLAR_INCLUDE_DIR=/home/lib/trunk/qgis/../qwtpolar/qwtpolar-1.1.1-imx53-shared/include
-DQWTPOLAR_LIBRARY=/home/lib/trunk/qgis/../qwtpolar/qwtpolar-1.1.1-imx53-shared/lib/libqwtpolar.so
-DCMAKE_SYSTEM_PROCESSOR=/home/toolchain/imx53 -DCMAKE_AR=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-ar
-DCMAKE_RANLIB=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-ranlib
-DCMAKE_NM=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-nm
-DCMAKE_OBJCOPY=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-objcopy
-DCMAKE_OBJDUMP=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-objdump
-DCMAKE_STRIP=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-strip
-DCMAKE_C_COMPILER=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-gcc
-DCMAKE_CXX_COMPILER=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-g++
Also, I built geos-3.3.9 with this configuration:
cmake -G "Unix Makefiles"
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_INSTALL_PREFIX=/home/lib/trunk/geos/geos-3.3.9-imx53-shared
-DCMAKE_BUILD_TYPE=RELEASE
-DGEOS_ENABLE_TESTS=OFF
-DBUILD_TESTING=OFF
-DHAVE_LONG_LONG_INT_64=OFF
-DCMAKE_SYSTEM_PROCESSOR=/home/toolchain/imx53
-DCMAKE_AR=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-ar
-DCMAKE_RANLIB=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-ranlib
-DCMAKE_NM=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-nm
-DCMAKE_OBJCOPY=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-objcopy
-DCMAKE_OBJDUMP=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-objdump
-DCMAKE_STRIP=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-strip
-DCMAKE_C_COMPILER=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-gcc
-DCMAKE_CXX_COMPILER=/home/toolchain/imx53/bin/arm-cortex_a8-linux-gnueabi-g++
When I take a look at the build error of qgis, I think that this problem is caused by some configuration error of geos at built. But I do not find anything. Also I tried to assign the geos path to rpath for qgis, nothing changed.
I do not know why I get this error. If somebody has an idea, please guide me to solve this problem.
Thanks.