qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake


From: Jag Raman
Subject: Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake
Date: Fri, 18 Feb 2022 14:49:06 +0000


> On Feb 18, 2022, at 7:13 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> On 2/18/22 04:40, Jag Raman wrote:
>>> On Feb 17, 2022, at 7:09 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> 
>>> On Thu, 17 Feb 2022 at 07:56, Jagannathan Raman <jag.raman@oracle.com> 
>>> wrote:
>>>> 
>>>> The compiler path that cmake gets from meson is corrupted. It results in
>>>> the following error:
>>>> | -- The C compiler identification is unknown
>>>> | CMake Error at CMakeLists.txt:35 (project):
>>>> | The CMAKE_C_COMPILER:
>>>> | /opt/rh/devtoolset-9/root/bin/cc;-m64;-mcx16
>>>> | is not a full path to an existing compiler tool.
>>>> 
>>>> Explicitly specify the C compiler for cmake to avoid this error
>>> 
>>> This sounds like a bug in Meson. Is there a Meson bug report
>>> we can reference in the commit message here ?
>> Hi Peter,
>> This issue reproduces with the latest meson [1] also.
> 
> 0.60.0 or more recent versions should have a fix, which would do exactly what 
> this patch does: do not define CMAKE_C_COMPILER_LAUNCHER, and place the whole 
> binaries.c variable in CMAKE_C_COMPILER.  What are the contents of the 
> genrated CMakeMesonToolchainFile.cmake and CMakeCache.txt files, without and 
> with your patch?

I’ll checkout what’s going on at my end. But the issue reproduces with
meson 0.61 from what I can tell:
# ../configure --target-list=x86_64-softmmu --enable-debug 
--enable-vfio-user-server;
The Meson build system
Version: 0.61.2
…
…
| /opt/rh/devtoolset-9/root/usr/bin/cc;-m64;-mcx16

| is not a full path to an existing compiler tool.


Concerning the generated files, I see the following in 
CMakeMesonToolchainFile.cmake:
Without patch: set(CMAKE_C_COMPILER "/opt/rh/devtoolset-9/root/usr/bin/cc" 
"-m64" "-mcx16”)
With patch: set(CMAKE_C_COMPILER "cc" "-m64" "-mcx16")

> 
>> I noticed the following about the “binaries” section [2]. The manual
>> says meson could pass the values in this section to find_program [3].
>> As such I’m wondering if it’s OK to set compiler flags in this section
>> because find_program doesn’t seem to accept any compiler flags.
> 
> The full quote of the manual is "These can be used internally by Meson, or by 
> the find_program function", and the C compiler variable "c" is in the former 
> category.
> 
> There is an important difference between the flags in "binaries" and those in 
> "built-in options". What is in "binaries" is used when requesting e.g. the 
> compiler search path, while what is in "built-in options" is not.  So options 
> like "-m32" are definitely part of "binaries", not "built-in options":
> 
>    $ gcc --print-multi-os-directory
>    ../lib64
>    $ gcc -m32 --print-multi-os-directory
>    ../lib

Do you know if the “host_machine” section in cross build
definition file [1] would be any help here?

[1]: https://mesonbuild.com/Cross-compilation.html#machine-entries

--
Jag

> 
> Paolo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]