Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with getenv(USER) in src/CompilerWrapper.cpp #30

Open
valassi opened this issue Jan 17, 2023 · 2 comments
Open

Issues with getenv(USER) in src/CompilerWrapper.cpp #30

valassi opened this issue Jan 17, 2023 · 2 comments

Comments

@valassi
Copy link

valassi commented Jan 17, 2023

Hallo! I have been doing some minor contributions to the port of the LHCb simulation to ARM, and on the way I found a peculiar issue in AmpGen.

In this line

os << "/** Generated by " << getenv("USER") << " on " << dt ;

the getenv(USER) call seems to give issues in my buid environment (a podman container on an ARM node).

In my podman container the USER env variable is not set for some reasons. This ends up generating source code through ampgen which is truncated, which in itself ends up giving me build errors like this

[15/69] Building CXX object Gen/LbAmpGen/CMakeFil...a_val1.dir/ampgen_models/BtoKpipigamma_val1.cpp.o
FAILED: Gen/LbAmpGen/CMakeFiles/LbBtoKpipigamma_val1.dir/ampgen_models/BtoKpipigamma_val1.cpp.o 
ccache /workspace/Gauss/build.armv8.1_a-centos7-gcc11-opt/toolchain/g++ -DGAUDI_V20_COMPAT -DLbBtoKpipigamma_val1_EXPORTS -I/cvmfs/lhcb.cern.ch/lib/lcg/releases/clhep/2.4.5.1-ebe73/aarch64-centos7-gcc11-opt/lib/CLHEP-2.4.5.1/../../include -march=armv8.1-a  -fmessage-length=0 -pipe -fdiagnostics-color -pedantic -Wall -Wextra -Werror=return-type -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wnon-virtual-dtor -Wsuggest-override -Wno-unused-parameter -O3 -O3 -DNDEBUG -fPIC -std=gnu++17 -MD -MT Gen/LbAmpGen/CMakeFiles/LbBtoKpipigamma_val1.dir/ampgen_models/BtoKpipigamma_val1.cpp.o -MF Gen/LbAmpGen/CMakeFiles/LbBtoKpipigamma_val1.dir/ampgen_models/BtoKpipigamma_val1.cpp.o.d -o Gen/LbAmpGen/CMakeFiles/LbBtoKpipigamma_val1.dir/ampgen_models/BtoKpipigamma_val1.cpp.o -c Gen/LbAmpGen/ampgen_models/BtoKpipigamma_val1.cpp
Gen/LbAmpGen/ampgen_models/BtoKpipigamma_val1.cpp:11:1: error: unterminated comment
   11 | /** Generated by
      | ^

I guess this could be solved by simply setting USER, but when I tried it failed (I think this is because I should have done a rebuild from scratch of the LHCb Gauss package, otherwise ampgen sopurce code is not regenerated?).

Anyway, my suggestion would be to add some sort of protection in "getenv(USER)" to handle correctly also the case when USER is not set.

In my LHCb Gauss build I simply added a hard workaround by removing getenv(USER) completely.
https://gitlab.cern.ch/lhcb/Gauss/-/merge_requests/920
(Note: this also includes another patch for ARM for an issue with -march that you have since fixed in a newer version).

Thanks
Andrea

@tevans1260
Copy link
Contributor

Dear Andrea,
Thanks for reporting.
I'll make a merge that fixes this shortly, then tag the corresponding change to be put into gauss.
Cheers, Tim.

@valassi
Copy link
Author

valassi commented Feb 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants