Open madebr opened 3 years ago
I also had the exact same issue as conan-io/conan-center-index#3619 when trying to create my own mongo-cxx recipe (thanks @madebr for the hint). In my case I had set PKG_CONFIG_PATH to /usr/local/lib/pkgconfig
(don't remember why). In any case I expected this to work similar to how self.env_info.PATH.append(bindir)
works so I didn't expect this either. It would be great if in such a case that the build would fail if that environment variable is not set properly we get a meaningful error.
I agree this sounds a good feature. Logging some variables make sense, and I like the ideas of being able to fully control the environment. Some of the ongoing work in profiles (https://github.com/conan-io/conan/pull/7945, https://github.com/conan-io/conan/pull/7922) might introduce the possibility of reading and redefining env-vars, which might partially help with this.
The environment discussion will follow once the new Toolchain are a bit more stabilized, thanks for the feedback, it will be considered.
Conan does keep the system environment uintact and will thus pick up (system) environment variables. Because build environments differ, this can cause builds to inexplicably fail. See e.g. https://github.com/conan-io/conan-center-index/issues/3619.
I think it would be useful to have a way to audit these sneaky variables. As a first step, printing these variables variables before building would be useful to have a paper trail what variables are set.
Conan being a C/C++ package manager, I think only the relevant variables should be logged. Such as: PKG_CONFIG_PATH, CC, CXX, CFLAGS, CXXFLAGS, CPPFLAGS, LIBS, CC_BUILD, CXX_BUILD, CC_FOR_BUILD, CXX_FOR_BUILD, CC_BUILD_FLAGS, ... (All variables with CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS/LIBS/... in them)
Extending on this feature, the following things become possible:
make it possible to error when a build system environment variable is detected (fail hard to attract attention to a potential problem)
make it possible to block these build environment variables in a profile (I think this would have avoided https://github.com/conan-io/conan-center-index/issues/3619) by removing them
[x] I've read the CONTRIBUTING guide.