Opened 7 months ago
Last modified 7 months ago
#69839 new enhancement
Handle CC_FOR_BUILD and CXX_FOR_BUILD where they are used but not actually set
Reported by: | barracuda156 | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | 2.9.3 |
Keywords: | Cc: | ryandesign (Ryan Carsten Schmidt), jmroot (Joshua Root), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) | |
Port: |
Description
There were several cases of ports being broken by careless usage of CC_FOR_BUILD
and/or CXX_FOR_BUILD
while those were not set to anything. In result, Macports compiler settings get ignored, and a system default compiler is picked or even some random one. That cannot work correctly.
What we actually need it that the right compiler is picked for the build.
Can this be fixed in the base instead of per-port patches?
Change History (4)
comment:1 Changed 7 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Cc: | MarcusCalhoun-Lopez added |
---|
comment:2 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
comment:3 Changed 7 months ago by kencu (Ken)
meson, in particular, uses CC_FOR_BUILD and CXX_FOR_BUILD when cross-compiling.
https://mesonbuild.com/Cross-compilation.html
https://mesonbuild.com/Reference-tables.html#environment-variables-per-machine
comment:4 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
That could at least be handled by the meson portgroup. That prompted me to check the portgroups. At the moment, only the muniversal 1.1 portgroup sets them. It also deals with CFLAGS_FOR_BUILD
, CPPFLAGS_FOR_BUILD
, CXXFLAGS_FOR_BUILD
, and LDFLAGS_FOR_BUILD
. I'm not sure who uses those or what we should put in there by default, if we added support for those to base as well.
As far as I know it is not a widespread problem because not many build systems use
CC_FOR_BUILD
orCXX_FOR_BUILD
. Today I see only 18 portfiles mentioning the former and 1 setting the latter. However it might be nice to handle it centrally.Presumably what you want is for new options
configure.cc_for_build
andconfigure.cxx_for_build
to be introduced. These would default to${configure.cc}
and${configure.cxx}
. TheCC_FOR_BUILD
andCXX_FOR_BUILD
environment variables would be set to${configure.cc_for_build}
and${configure.cxx_for_build}
.I see a couple ports (gtk3, gtk3-devel, fossil) including the
-arch
flag. I would guess that should not be done because the whole point of these env vars is to specify a compiler that builds things for the build machine and it should do so without needing to be told what arch to do it for, and especially if you are, for example, on an x86_64 machine building for arm64, then you do not want-arch arm64
to be used to compile things that will need to run on the x86_64 build machine.