I am trying to build on windows using meson and conan.
I installed packages for VS 2017 using conan and generated the PC files in the build directory.
Inside my conan.py I have the snippet:
meson = Meson(self)
self.output.warn(self.folders.generators)
meson.configure(build_folder="build", args=[
f"-Dpkg_config_path={self.folders.generators}",
f"-Db_sanitize=undefined"
])
meson.build(args=['-j2'])
I have checked and confirmed this works and that the directory is correct.
I also tried using absolute paths by doing:
os.path.abspath(self.folders.generators)
But meson still cannot find the package for some reason.
The exact error is:
Found pkg-config: C:\msys64\mingw64\bin\pkg-config.EXE (1.8.0)
Found CMake: C:\Program Files\CMake\bin\cmake.EXE (3.22.1)
Run-time dependency vulkan-memory-allocator found: NO (tried pkgconfig and cmake)
..\meson.build:97:0: ERROR: Dependency "vulkan-memory-allocator" not found, tried pkgconfig and cmake
A full log can be found at C:\Users\Makogan\Documents\neverengine\build\meson-logs\meson-log.txt
FAILED: build.ninja
"C:\Python311\Scripts\meson" "--internal" "regenerate" "C:\Users\Makogan\Documents\neverengine" "C:\Users\Makogan\Documents\neverengine\build" "--backend" "ninja"
ninja: error: rebuilding 'build.ninja': subcommand failed
ERROR: conanfile.py: Error in build() method, line 108
meson.build(args=['-j2'])
ConanException: Error 1 while executing ninja -C "C:\Users\Makogan\Documents\neverengine\build" -j2
It does work if I do meson --reconfigure -Dpkg_config=<path>.
I am confused.
Try specify instead -Dbuild.pkg_config_path=... from this
Since 0.51.0, some options are specified per machine rather than
globally for all machine configurations. Prefixing the option with
build. just affects the build machine configuration...
build.pkg_config_path controls the paths pkg-config will search for
just native: true dependencies (build machine).
PS, the version of meson and that you have native build I deduced from your previous question ;)
Related
I am trying to port a Linux Library to windows, the library uses meson for compilation. I have a dummy meson.build file:
project(
'Dummy',
'cpp',
version: '0.0.1',
license: 'GPL',
default_options : [
'cpp_std=c++latest',
'default_library=static',
'optimization=3',
'buildtype=debugoptimized'])
When I run meson configure I get:
PS C:\Users\Makogan\Documents\neverengine\build> meson compile
[0/1] Regenerating build files.
The Meson build system
Version: 0.60.3
Source dir: C:\Users\Makogan\Documents\neverengine
Build dir: C:\Users\Makogan\Documents\neverengine\build
Build type: native build
Project name: NeverEngine
Project version: 0.0.1
C++ compiler for the host machine: cl (msvc 19.13.26131.1 "Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26131.1 for x64")
C++ linker for the host machine: link link 14.13.26131.1
..\meson.build:1:0: ERROR: Unknown linker(s): [['lib'], ['llvm-lib']]
The following exception(s) were encountered:
Running "lib /?" gave "[WinError 2] The system cannot find the file specified"
Running "llvm-lib /?" gave "[WinError 2] The system cannot find the file specified"
A full log can be found at C:\Users\Makogan\Documents\neverengine\build\meson-logs\meson-log.txt
FAILED: build.ninja
"C:\Python311\Scripts\meson" "--internal" "regenerate" "C:\Users\Makogan\Documents\neverengine" "C:\Users\Makogan\Documents\neverengine\build" "--backend" "ninja"
ninja: error: rebuilding 'build.ninja': subcommand failed
Why is meson automatically searching for these libraries when it is aware it is on windows?
Those aren't libraries, those are static linkers (also called archivers), which are used to produce static libraries (those ending in .a or .lib, usually). Those are pretty important to meson, and it assumes that it can find the three pieces of the toolchain (The compiler, the archiver, and the [dynamic] linker) for any given language + machine.
It is interesting to me that meson is able to pick up the cl.exe and link.exe, but not lib.exe
I am compiling C/C++ to wasm with emscripten. And need boost library as well. Pretty new to emscripten and wasm
After installing emscripten and boost. I ran the following command
emconfigure cmake -DBoost_DEBUG=1
-Dboost_headers_DIR=../boost_1_71_0/build/lib/cmake/boost_headers-1.71.0
-DBoost_DIR=../boost_1_71_0/build/lib/cmake/Boost-1.71.0 -Dboost_program_options_DIR=../boost_1_71_0/build/lib/cmake/boost_program_options-1.71.0
-Dboost_system_DIR=../boost_1_71_0/build/lib/cmake/boost_system-1.71.0 -Dboost_thread_DIR=../boost_1_71_0/build/lib/cmake/boost_thread-1.71.0 -Dboost_unit_test_framework_DIR=../boost_1_71_0/build/lib/cmake/boost_unit_test_framework-1.71.0
-DZLIB_INCLUDE_DIR=${HOME}/.emscripten_ports/zlib/zlib-version_1 -DZLIB_LIBRARY=${HOME}/.emscripten_cache/asmjs -DBUILD_TESTING=0 -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBUILD_EXEC=OFF -DBUILD_TESTING=OFF ..
I get the following error
CMake Error at /home/../boost_1_71_0/build/lib/cmake/boost_thread-1.71.0/boost_thread-config.cmake:91 (find_package):
Could not find a package configuration file provided by "boost_atomic"
(requested version 1.71.0) with any of the following names:
boost_atomicConfig.cmake
boost_atomic-config.cmake
Add the installation prefix of "boost_atomic" to CMAKE_PREFIX_PATH or set
"boost_atomic_DIR" to a directory containing one of the above files. If
"boost_atomic" provides a separate development package or SDK, be sure it
has been installed.
The boost_atomic-config.cmake is at /home/../boost_1_71_0/build/lib/cmake/boost_atomic-1.71.0/boost_atomic-config.cmake. How should I set the boost_atomic_DIR path to this file, as required above?
I added a flag -Dboost_atomic_DIR=/path/to/.cmake/file in the above command and it worked.
Windows 64bit using cmake to compile c++ project: github.com/iHateInventNames/synergy-through-usb
I fixed a previous issue in this post: Compile issues: LIBUSB_1 with cmake project on Windows
So when I hit cmake now I get the following error:
> cmake .
-- Found libusb-1.0:
-- - Includes: C:/local/libs/libusbx
-- - Libraries: C:/local/libs/libusbx/libusb-1.0.lib
You have called ADD_LIBRARY for library cryptopp without any source files. This typically indicates a problem with your CMakeLists.txt file
-- Configuring done
CMake Error: CMake can not determine linker language for target: cryptopp
CMake Error: CMake can not determine linker language for target: cryptopp
CMake Error: CMake can not determine linker language for target: cryptopp
CMake Error: CMake can not determine linker language for target: cryptopp
-- Generating done
-- Build files have been written to: C:/local/projects/synergy-usb/synergy-through-usb-master
What does this mean? how can I solve it / move on?
Links to the install instructions
both goto 404 errors...
http://synergy-project.org/projects/synergy/wiki/Readme/?hl=pm
http://synergy-project.org/projects/synergy/wiki/Compiling/?hl=pm
Based on a quick browse through the project's CMakeLists, it would seem you're supposed to unpack tools/cryptopp562.zip into a directory called tools/cryptopp562 before running CMake. This should definitely have been mentioned in the projects' installation instructions, if any.
More precisely, the file tools/CMakeLists.txt contains this code:
set(cpp_dir cryptopp562)
file(GLOB cpp_src ${cpp_dir}/*.cpp)
# ...
add_library(cryptopp STATIC ${cpp_src})
This means that the variable cpp_src is filled with source files taken from directory cryptopp562 (relative to the CMakeList's directory, i.e. tools), and is then used to define the source files of library cryptopp. However, the project's distribution only contains tools/cryptopp562.zip. Unpacking that into directory tools/cryptopp562 should provide the missing files.
I would like to use GPGME for key generation and encryption in my C++ application. However, while trying to get started, I got stuck with a problems:
I dowloaded the dev package for my debian system. Now I would like to tell my compiler (gcc in Qt Creator) where to find the library with cmake using the tool mentioned in the documentation. But I don't know how to add gpgme-config --cflags --libs to my compiler flags. This didn't work:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} `gpgme-config --cflags --libs` ")
When I try to build the app the compiler can't find gpgme-config:
c++: error: $(gpgme-config: File or Directory not found
c++: error: unrecognized command line option ‘--cflags’
c++: error: unrecognized command line option ‘--libs)’
Anyway executing gpgme-config --cflags --libs on command line DOES give me a result:
-L/usr/lib/x86_64-linux-gnu -lgpgme -lassuan -lgpg-error
I know the documentation also mentions Automake and libtool to make this process easier. But I neither used Automake or libtool before.
UPDATE:
I also tried to use a FindGpgme.cmake file for GPGME. But the first file I used required several other cmake files, which I also downloaded. I put them in the same directory as FindGpgme.cmake. The main cmake file (FindGpgme.cmake) was found, but MacroEnsureVersion and MacroBoolTo01 not. My change to my CMakeLists.txt was the following:
include(cmake_modules/FindGpgme.cmake)
find_package(Gpgme)
I tried relative and absolute path to the other files in FindGpgme.cmake. Same problem - cmake can't find them. My second try was with the file I found on gitweb. The error was:
CMake Error at cmake_modules/FindGpgme.cmake:376 (set_package_properties):
Unknown CMake command "set_package_properties".
Call Stack (most recent call first):
CMakeLists.txt:7 (include)
I have absolutely no glue how to fix that set_package_properties problem.
UPDATE 2
I added
include(FeatureSummary)
to my CMakeLists.txt as proposed by kfunk. Now I get the following error:
CMake Warning at CMakeLists.txt:9 (find_package): By not providing
"FindGpgme.cmake" in CMAKE_MODULE_PATH this project has asked CMake
to find a package configuration file provided by "Gpgme", but CMake
did not find one.
Could not find a package configuration file provided by "Gpgme" with
any of the following names:
GpgmeConfig.cmake
gpgme-config.cmake
Add the installation prefix of "Gpgme" to CMAKE_PREFIX_PATH or set
"Gpgme_DIR" to a directory containing one of the above files. If
"Gpgme" provides a separate development package or SDK, be sure it
has been installed.
Even the message description seams pretty detailed I don't know how to add the FindGpgme.cmake to CMAKE_MODULE_PATH or how to add the requested prefix to CMAKE_PREFIX_PATH. The dev package however is definitely installed (using package manager)
I'd suggest to use a proper CMake find script to look up the GPGME installation:
Example here:
https://quickgit.kde.org/?p=kwallet.git&a=blob&h=7a092104ba0604b0606c4662750b8b32c5c3e2c6&f=cmake%2FFindGpgme.cmake&o=plain
Then something like this in your CMake code (untested):
find_package(Gpgme)
include_directories(${GPGME_INCLUDES})
target_link_libraries(YOURTARGET ${GPGME_VANILLA_LIBRARIES)
I need to build boost to use the regex library. I was able to creat bjam using bootstrap.sh like so:
./bootstrap.sh --with-toolset=mingw
Note - if I leave out the --with-toolset=mingw argument compilation fails - bootstrap can't find wait.h, resource.h, ar.h. With the mingw toolset argument, bjam is able to compile. Then I run bjam and get:
./bjam.exe
mingw.jam: No such file or directory
e:/libraries/boost_1_45_0/tools/build/v2/build\toolset.jam:38: in toolset.using
rule mingw.init unknown in module toolset.
e:/libraries/boost_1_45_0/tools/build/v2/build\project.jam:881: in using
project-config.jam:12: in modules.load
e:/libraries/boost_1_45_0/tools/build/v2\build-system.jam:257: in load-config
e:/libraries/boost_1_45_0/tools/build/v2\build-system.jam:423: in load-configuration-files
e:/libraries/boost_1_45_0/tools/build/v2\build-system.jam:554: in load
e:\libraries\boost_1_45_0\tools\build\v2/kernel\modules.jam:283: in import
e:\libraries\boost_1_45_0\tools\build\v2\kernel\bootstrap.jam:142: in boost-build
e:\libraries\boost_1_45_0\boost-build.jam:17: in module scope
I tried several variations of parameters and get the same error:
./bjam.exe --build-dir=e:/libraries/boost_1_45_0/ --toolset=mingw
./bjam.exe --build-dir=e:/libraries/boost_1_45_0/ --toolset=gcc
Not sure how to get bjam to build. Any suggestions?
Once you have built bjam with ./bootstrap.sh --with-toolset=mingw
Edit the file project-config.jam and replace 'mingw' by 'gcc'
Then launch bjam.exe and it should work