Closed rhd closed 4 years ago
confirmed.
On the machine it was failing on, I installed mingw and now the meson command is working.
Meson requires that you have both a native compiler and a cross compiler available when doing cross compilations.
Hmm, that means I have to get windows people to install mingw to use the xilinx cross compiler? I can't imagine that's going to go over well...
maybe I can set the CC
/CXX
env variables to some other compiler that comes with the xilinx stuff. Meson will pick that up for the native tooling when using --cross-file
?
Is there a particular reason why a native compiler is required?
Most of them have to do with laziness. The implementation code is a lot simpler if it can always assume that the native compiler exists and is usable. We don't have to have special checking code when people do native : true
etc.
That being said we could probably accept a patch to fix this assuming it does not complicate the internals too much.
The error message should also definitely be improved to explicitly state what's missing.
I looked into this a bit, as having this would simplify adding cross ARM MSVC to CI.
This looks doable, but I think that we will need to extend the meson language so it's possible to say if a native compiler is required or not.
e.g.
add_languages()
, gains a native:
keyword, indicating if a native or cross compiler is required. For backwards compatibility, if the keyword is absent, that means both are required.
project()
gains a native_languages:
keyword, listing the languages for which a native compiler is required. For backwards compatibility, if absent, the default value is the list of (host) languages given to project()
An alternative approach is not to add a keyword but just try to look up the compilers and if they are not found, then ignore them and later if the build definition tries to build a native target, exit with a hard error.
Yeah, I looked into doing it lazily, but as well as being a lot more work, there is at least one more problem:
add_languages(required: false)
is supposed to return false if the required compiler(s) can't be found, but currently we can't know if a native compiler is required until after we've finished executing the entire meson.build
After #4010, it will be really really really easy. (I was planning on doing this / native
kwarg for add_language
anyways.)
Is there now a way to disable the native compiler? If so, how does it work? In my company we are currently evaluating different build systems and a useless dependency on a native compiler is a no-go.
It wasn't in #4010, but is easy to do now that it's merged. I have some regressions to fix before new features, but I'll help anyone else start this sooner.
After #4010, it will be really really really easy
Well, I must be dumb because it involved a lot of work, but I have made an attempt at this in #6512.
An alternative approach is not to add a keyword but just try to look up the compilers and if they are not found, then ignore them
I took the simple approach of always declaring what languages are used for what machine. It's certainly possible to do this lazily as a refinement, but there are multiple points where the interpreter wants information from the compiler object, which are not well surfaced at the moment.
in interpeter.py: 2790: `try:
comp = self.environment.detect_compiler_for(lang, for_machine)
if comp is None:
raise InvalidArguments('Tried to use unknown language "%s".' % lang)
comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
except Exception:
if not required:
mlog.log....`
An error occurred in detect_compiler_for, and the Execption part will not be executed
I have a windows machine with the latest
.msi
installed - version0.42.1
.I set my path like this:
This is my cross file (I've tried also tried full paths but it makes no difference:
Meson prints this error:
What's interesting is that on another windows machine, I do have
clang
andgcc
in the path and this exact same command works perfectly.