I am past the problem I had above that was due to ...
# general
n
I am past the problem I had above that was due to using old version of pants 2.15.0 - now I am on 2.24.0. The problem I have now is, because of stuff beyond my control I must use an old version of this python lib: awscrt==0.13.5. I cannot use a newer version. The issue is that when the wheel is built for that, gcc raises a warning and because warnings are treated as errors, tests fail. I have this in pants.toml but it appears not to be helping:
Copy code
[test]
extra_env_vars = [
  # must turn off array-bounds warning in gcc because we are stuck on awscrt==0.13.5 and that version of awscrt
  # provokes a warning from gcc which is treated as an error. we are stuck with that version of awscrt because it is
  # required by atlasground-freedom-api==2.1.16, which is a closed-source package we have from Atlas.
  # passing these flags does not work in pants 2.15 (the warning is still treated as error) which is why when we
  # upgraded to debian bookworm we also had to upgrade pants to latest at the time, 2.24.0
  'CFLAGS=-Wno-error=array-bounds',
  'CXXFLAGS=-Wno-error=array-bounds',
  'CMAKE_C_FLAGS=-Wno-error=array-bounds',
  'CMAKE_CXX_FLAGS=-Wno-error=array-bounds',
  # this is so tests that use Orekit can find java
  'LD_LIBRARY_PATH=/usr/lib/jvm/temurin-8-jdk-amd64/jre/lib/amd64:/usr/lib/jvm/temurin-8-jdk-amd64/jre/lib/amd64/server/'
]
I'll put more detail under this comment so as not to spam the channel here with too many logs
this is the pants command I am running:
Copy code
./pants --print-stacktrace -ldebug test :: --tag=-integration
this is the error. Not showing the entire log as it's much larger than this since I had debug turned on. This is just the error at the very end. It seems like the env vars that should cause CMake to ignore the array-bounds warning are not being used.
the cmake call is this, on line 304 of that log file above. I don't see anywhere in the log where the env vars in
extra_env_vars
are called out. It's not clear to me if they would be visible to CMake there but it seems the are not.
Copy code
/usr/bin/cmake -DCMAKE_PREFIX_PATH=/root/.cache/pants/named_caches/pex_root/pip/1/24.2/pip_cache/.tmp/pip-req-build-7523qoju/build/deps/install -DCMAKE_INSTALL_PREFIX=/root/.cache/pants/named_caches/pex_root/pip/1/24.2/pip_cache/.tmp/pip-req-build-7523qoju/build/deps/install -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_LIBSSL=OFF -DDISABLE_PERL=ON -DDISABLE_GO=ON /root/.cache/pants/named_caches/pex_root/pip/1/24.2/pip_cache/.tmp/pip-req-build-7523qoju/crt/aws-lc
the reason I cannot upgrade awscrt is this: we are using a closed source lib from a third party vendor that has awscrt==0.13.5 in its requirements. I can ask them to fix their stuff but it could be many months or never before they fix it. Basically I cannot wait for them to fix it.
g
https://www.pantsbuild.org/stable/reference/subsystems/python-native-code should to do what you need, after a quick glance at the Pants sources.
n
aha thanks i'll give that a try!
g
(It seems like it only allows setting LDFLAGS and CPPFLAGS, not arbitrary env... if you need all of those it shouldn't be hard for us to add them)
It might be a bit weird with interactions since it'd apply to all dists built, but it's the only method I could find.
n
what about CFLAGS
the code in question that is generating the warning is C, not C++
in any case I'll throw a "-Wno-error=array-bounds" in there and see if it builds
g
Can definitely add a CFLAGS, but might at best be in 2.25 I think (and that's an unlikely outcome, since that's on RC track.)
n
ok thanks. i'll report back here whether CPPFLAGS works for me but it seems unlikely
g
https://www.pantsbuild.org/dev/reference/subsystems/subprocess-environment#env_vars could also work; I can't see where it'd get applied in the code but the description seems like it'd apply.
n
this worked with 2.24.0, thanks! probably the CFLAGS one but I didn't bother taking the rest out to find out
Copy code
[subprocess-environment]
env_vars = [
  # must turn off array-bounds warning in gcc because we are stuck on awscrt==0.13.5 and that version of awscrt
  # provokes a warning from gcc which is treated as an error. we are stuck with that version of awscrt because it is
  # required by atlasground-freedom-api==2.1.16, which is a closed-source package we have from Atlas.
  # passing these flags does not work in pants 2.15 (the warning is still treated as error) which is why when we
  # upgraded to debian bookworm we also had to upgrade pants to latest at the time, 2.24.0
  'CFLAGS=-Wno-error=array-bounds',
  'CXXFLAGS=-Wno-error=array-bounds',
  'CMAKE_C_FLAGS=-Wno-error=array-bounds',
  'CMAKE_CXX_FLAGS=-Wno-error=array-bounds',
]