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

Issue compiling with cons #706

Open
dkapukchyan opened this issue Aug 17, 2024 · 0 comments
Open

Issue compiling with cons #706

dkapukchyan opened this issue Aug 17, 2024 · 0 comments

Comments

@dkapukchyan
Copy link
Contributor

I (we) have encountered an interesting error when compiling with cons. This issue came up when StEnumerations.h was changed and StVertex.h was changed along with a few others but those are not relevant to the issue. I think this error is only happening because we are trying to build on top of existing STAR headers and code and depending on how the code was written to specify the various needed headers it causes the cons build system to sometimes grab the existing ones in the $STAR directory instead of the ones in your current directory.
To help explain, here is the offending compiler command which returns an error because it couldn't find the new changes in StEnumerations.h.

g++ -m32 -fPIC -pipe -Wall -Woverloaded-virtual -std=c++0x -Wno-long-long -pthread -Wno-deprecated-declarations -g -Dsl73_gcc485 -D__ROOT__ -DNEW_DAQ_READER -I. -IStRoot -I.sl73_gcc485/include -IStRoot/StEventUtilities -I. -IStRoot -I.sl73_gcc485/include -I/afs/rhic.bnl.gov/star/packages/DEV -I/afs/rhic.bnl.gov/star/packages/DEV/StRoot -I/afs/rhic.bnl.gov/star/packages/DEV/.sl73_gcc485/include -I/cvmfs/star.sdcc.bnl.gov/star-spack/spack/opt/spack/linux-rhel7-x86/gcc-4.8.5/root-5.34.38-llsepmmfuwlsucogcwbjiodncxanoudt/include -I/afs/rhic.bnl.gov/star/packages/DEV/StRoot/StEventUtilities -I/afs/rhic.bnl.gov/star/packages/DEV -I/afs/rhic.bnl.gov/star/packages/DEV/StRoot -I/afs/rhic.bnl.gov/star/packages/DEV/.sl73_gcc485/include -I/cvmfs/star.sdcc.bnl.gov/star-spack/spack/opt/spack/linux-rhel7-x86/gcc-4.8.5/root-5.34.38-llsepmmfuwlsucogcwbjiodncxanoudt/include -c .sl73_gcc485/obj/StRoot/StEventUtilities/StEventHelper.cxx -o .sl73_gcc485/obj/StRoot/StEventUtilities/StEventHelper.o

If we break down the search paths of the include directories and get rid of reduncies we find this list of priorities.

  1. .
  2. StRoot
  3. .sl73_gcc485/include
  4. StRoot/StEventUtilities folder we are building
  5. /afs/rhic.bnl.gov/star/packages/DEV
  6. /afs/rhic.bnl.gov/star/packages/DEV/StRoot
  7. /afs/rhic.bnl.gov/star/packages/DEV/.sl73_gcc485/include
  8. /cvmfs/star.sdcc.bnl.gov/star-spack/spack/opt/spack/linux-rhel7-x86/gcc-4.8.5/root-5.34.38-llsepmmfuwlsucogcwbjiodncxanoudt/include
  9. /afs/rhic.bnl.gov/star/packages/DEV/StRoot/StEventUtilities
  10. /afs/rhic.bnl.gov/star/packages/DEV
  11. /afs/rhic.bnl.gov/star/packages/DEV/StRoot
  12. /afs/rhic.bnl.gov/star/packages/DEV/.sl73_gcc485/include
  13. /cvmfs/star.sdcc.bnl.gov/star-spack/spack/opt/spack/linux-rhel7-x86/gcc-4.8.5/root-5.34.38-llsepmmfuwlsucogcwbjiodncxanoudt/include

If we look at folder in priority 3 we find:

StEnumerations.h StFstConsts.h StFstHit.h StFwdTrackCollection.h StFwdTrack.h StVertex.h

These are symlinks that cons created before building the code and are most likely the only the headers that were changed. When I run cons on a clean build making the symlinks is part of the "install" step

Now let's take a look at the file we are compiling which is StEventHelper.cxx in StEventUtilites/. In StEventHelper.cxx we see the following relevant include lines

#include "StEvent.h"  //not modified but includes "StEnumerations.h" which was modified
#include "StObject.h"
...
#include "StVertex.h"  //modified file

So the first STAR header to include is StEvent.h which would be priority number 7 because cons did not create a StEvent.h in priority 3 (I am guessing this is because StEvent.h is unchanged from the dev version). So when cons found StEvent.h in priority 7, the StEnumerations.h file it uses is also coming from priority 7 and not priority 3. This results in the incorrect StEnumerations.h file being loaded which doesn't have the new changes. This can be avoided if you include "StEnumerations.h" before StEvent.h because it will load the one from priority 3 and the include guards will prevent re-inclusion.

This error only happens because we have another StEvent.h file to fall back on. I don't think this will happen in the official build when we integrate the code because there is no other StEvent.h, or StEnumerations.h file it can use. I just thought I should bring this up in case anyone else encounters this kind of error and to figure out what is the best solution in this case.

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

1 participant