Open Antonz0 opened 5 years ago
After adding direct path to cl.exe compiler to PATH (just got curious): C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
I'm getting this error instead:
meson.build:1:0: ERROR: Compiler cl can not compile programs.
So it's really looks that Meson on Windows is too happy with default compilers and just don't wants to use ones specified for cross-compilation for some reason. Or I'm doing it wrong.
Meson's cross compilation works slightly differently from other build systems. It requires both a native and a cross compiler so you can build tools such as code generators and use them during the build. The solution to this is to have a native compiler in the path, too. For your case the simplest way is to launch the builds from VS developer tools command console so it uses VS, but any native compiler in path will suffice.
I have a similar problem with cross-compilation for an embedded target with Infenion Tricore architecture. I did some digging and debugging. I found several inconsistencies in the path handling of the cross-file in general. Specifically, I found a problematic line in environment.py parse_datafile function. The following line changes a windows path
res = eval(value, {'__builtins__': None}, {'true': True, 'false': False})
The line converts \t in the path to hex and removes double backslashes, but not all of them. After replacing the line with below code the cross-compilation does not work because of other errors.
res = value
Also, I'd like to suggest a better way of handling crosscompilation and adding support for new cross-compilers. @jpakkane would you be interested in something like that?
res = value
This does not work in general, because we need to convert strings such as ['foo', 'bar']
into actual arrays. That's why the eval is there.
In general this is exactly the reason why you'd want to use /
as a path separator, even on Windows. Since backslash is a quote character, it will cause breakage all the time. That being said we should be able to handle those better. Would preprocessing by swapping all backslashes to regular slashes be enough or is there breakage potential?
Thanks switching to / worked on windows, but I still get an "Unknown compiler(s)" error emitted from a subproject. Can you suggest a solution?
The Meson build system Version: 0.48.999 Source dir: C:\Users\alex.briskin\all_work\delta_pc Build dir: C:\Users\alex.briskin\all_work\delta_pc\cross Build type: cross build Project name: delta_pc Project version: 0.0.1 Native C compiler: gcc (gcc 6.3.0 "gcc (MinGW.org GCC-6.3.0-1) 6.3.0") Cross C compiler: C:/HIGHTEC/toolchains/tricore/v4.9.1.0-infineon-2.0/bin/tricore-gcc.exe (gcc 4.9.4) Host machine cpu family: Tricore Host machine cpu: TC297 Target machine cpu family: Tricore Target machine cpu: TC297 Build machine cpu family: x86 Build machine cpu: x86
Executing subproject delta_core | |
---|---|
Project name: delta_core | |
Project version: 0.0.1 | |
Native C compiler: gcc (gcc 6.3.0 "gcc (MinGW.org GCC-6.3.0-1) 6.3.0") | |
Cross C compiler: C:/HIGHTEC/toolchains/tricore/v4.9.1.0-infineon-2.0/bin/tricore-gcc.exe (gcc 4.9.4) |
subprojects\delta_core\meson.build:1:0: ERROR: Unknown compiler(s): ['cl', 'c++', 'g++', 'clang++', 'clang-cl'] The follow exceptions were encountered: Running "cl /?" gave "[WinError 2] The system cannot find the file specified" Running "c++ --version" gave "[WinError 2] The system cannot find the file specified" Running "g++ --version" gave "[WinError 2] The system cannot find the file specified" Running "clang++ --version" gave "[WinError 2] The system cannot find the file specified" Running "clang-cl /?" gave "[WinError 2] The system cannot find the file specified"
A full log can be found at C:\Users\alex.briskin\all_work\delta_pc\cross\meson-logs\meson-log.txt
You seem to be missing the C++ compiler from your MinGW installation. It does find the C compiler but not the C++ one.
Maybe some need fix of this problem
sudo apt install g++
Hi.
I'm trying to cross-compile some third-party library (it's libepoxy from https://github.com/anholt/libepoxy/releases , latest stable version 1.5.3 ) for Android on Windows using Meson (also latest version 0.48.1) with no success.
Here's my cross config file (I took one example from http://dev-smart.com/cross-compiling-with-android/ and adapted it for my needs):
Android toolchain got extracted into
C:/TEMP/android_toolchain-arm
folder using standard methods (code from helper batch file to do it:%ANDROID_NDK_HOME%/build/tools/make_standalone_toolchain.py --arch arm --stl libc++ --api 16 -v --install-dir "C:/TEMP/android_toolchain-arm"
). I tried putting it to the simplest absolute path as possible. Tried various variants of specifying 'c' (arm-linux-androideabi-clang.cmd
,clang.cmd
,clang70.exe
) and 'cpp' (arm-linux-androideabi-clang++.cmd
,clang++.cmd
,clang70++.exe
) compilers in "bin" folder within toolchain folder - no luck.I'm invoking Meson from source root folder using following command:
Here's what I'm getting every time in a log:
"Не удается найти указанный файл" means "Cannot find file specified". It looks that Meson just ignores cross compilers that I'm trying to specify and just attempts to use some default set... And it actually parses cross-file because when I'm trying to set something syntactically wrong Meson reports an error about it.
When I'm building this library on MacOS X (some paths to toolchain executables are different here, of course) it works just fine. Here's example of cross-config file I use on MacOS X: