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

ROOT fails to build many builtins with CMake 3.30 (>=3.28) (when building in parallel (-j N)) #16733

Open
1 task done
andresailer opened this issue Oct 23, 2024 · 19 comments
Open
1 task done
Assignees
Labels

Comments

@andresailer
Copy link
Contributor

Check duplicate issues.

  • Checked for duplicates

Description

With newer versions of cmake like 3.30.5 at least some of ExternalProject_Add'ed builtins fail to compile with an error like

gmake[6]: *** read jobs pipe: Bad file descriptor.  Stop.
gmake[6]: *** Waiting for unfinished jobs....
gmake[5]: *** [CMakeFiles/Makefile2:97: CMakeFiles/pcre.dir/all] Error 2
gmake[4]: *** [CMakeFiles/Makefile2:104: CMakeFiles/pcre.dir/rule] Error 2
gmake[3]: *** [Makefile:179: pcre] Error 2

(here builtin PCRE failed)

I don't know with which version of cmake this starts failing, but we (SPI/LCG) moved from 3.26.2 to 3.30.
Unless one limits oneself to a small number of --jobs?

Reproducer

On lxplus or equivalent machines with CVMFS for example

export PATH=/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.30.5/Linux-x86_64/bin/:$PATH
git clone https://github.com/root-project/root.git
cd root
mkdir build
cd build
cmake -D builtin_pcre=ON ..
make -j8

ROOT version

any? (definitely HEAD)

Installation method

build from source

Operating system

Linux

Additional context

No response

@bellenot bellenot self-assigned this Oct 23, 2024
@bellenot
Copy link
Member

Is it really a ROOT bug? Or a CMake one? 🤔

@bellenot
Copy link
Member

OK, so apparently it's only builtin_pcre which is causing problems (i.e. pcre-8.43.tar.bz2)

@bellenot
Copy link
Member

FYI there is the same error with pcre 8.45 (which is the latest available). Investigating...

@bellenot
Copy link
Member

OK, I found a work-around. PR is coming soon. And note that the issue is not present on Windows

@andresailer
Copy link
Contributor Author

It probably depends on which builtins you enable?
I also see this for builtin_XROOTD

gmake[4]: *** read jobs pipe: Bad file descriptor.  Stop.
gmake[4]: *** Waiting for unfinished jobs....
gmake[3]: *** [Makefile:146: all] Error 2

@bellenot
Copy link
Member

Oh crap! I can't build XRootD... OK, thanks! I'll do the same with XRootD. Anything else?

@bellenot
Copy link
Member

Note that would be interesting to see if it's possible to build XRootD in parallel outside ROOT

@andresailer
Copy link
Contributor Author

andresailer commented Oct 23, 2024

I haven't found anything else so far. Do you have a cmake command to enable all builtins?

And yes we build xrootd outside of ROOT for the LCG stacks with cmake 3.30 without problems.
Heck, I can build pcre outside of ROOT without problems as well.

@bellenot
Copy link
Member

bellenot commented Oct 23, 2024

I haven't found anything else so far. Do you have a cmake command to enable all builtins?

I don't think so

And yes we build xrootd outside of ROOT for the LCG stacks with cmake 3.30 without problems. Heck, I can build pcre outside of ROOT without problems as well.

OK, so I'll have to spend more time on this... Thanks Andre!

@andresailer
Copy link
Contributor Author

ccmake to the rescue...
TBB

gmake[5]: *** read jobs pipe: Bad file descriptor.  Stop.
gmake[5]: *** Waiting for unfinished jobs....
gmake[4]: *** [CMakeFiles/Makefile2:134: src/tbb/CMakeFiles/tbb.dir/all] Error 2
gmake[3]: *** [Makefile:156: all] Error 2

FFTW3

make[5]: *** read jobs pipe: Bad file descriptor.  Stop.
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile:708: all-recursive] Error 1
make[3]: *** [Makefile:552: all] Error 2

freetype (in the configure step??? 😕 )

make[3]: *** read jobs pipe: Bad file descriptor.  Stop.
make[3]: *** Waiting for unfinished jobs....

@andresailer
Copy link
Contributor Author

cfitsio

gmake[5]: *** read jobs pipe: Bad file descriptor.  Stop.
gmake[5]: *** Waiting for unfinished jobs....
gmake[4]: *** [CMakeFiles/Makefile2:83: CMakeFiles/cfitsio.dir/all] Error 2
gmake[4]: Target 'all' not remade because of errors.
gmake[3]: *** [Makefile:136: all] Error 2
gmake[3]: Target 'default_target' not remade because of errors.

I couldn't enable builtin_zlib, gave some other cmake error

CMake Error at interpreter/llvm-project/llvm/lib/Support/CMakeLists.txt:303 (get_property):
  The LOCATION property may not be read from target "ZLIB".  Use the target
  name directly with add_custom_command, or use the generator expression
  $<TARGET_FILE>, as appropriate.



CMake Error at interpreter/llvm-project/llvm/lib/Support/CMakeLists.txt:306 (get_property):
  The LOCATION property may not be read from target "ZLIB".  Use the target
  name directly with add_custom_command, or use the generator expression
  $<TARGET_FILE>, as appropriate.



CMake Error at interpreter/llvm-project/llvm/lib/Support/CMakeLists.txt:308 (get_library_name):
  get_library_name Function invoked with incorrect arguments for function
  named: get_library_name

@bellenot
Copy link
Member

OK, thanks André! It looks like CMake is badly broken...

@bellenot
Copy link
Member

Looking there: https://www.kitware.com/cmake-3-28-0-rc5-is-ready-for-testing/
It seems adding BUILD_JOB_SERVER_AWARE true in ExternalProject_Add fixes the issue (at least for PCRE). Trying it right now (but xrootd fails for some reason...)

@bellenot
Copy link
Member

Adding BUILD_JOB_SERVER_AWARE 1 partially fixes the issue, but adding it only for CMake version > 3.28 in something like 50 different places would be a pain in the neck...
see also https://gitlab.kitware.com/cmake/cmake/-/issues/26398

@andresailer
Copy link
Contributor Author

andresailer commented Oct 24, 2024

For XROOTD I didn't see BUILD_JOB_SERVER_AWARE helping, the doc also says that it only applies to explicit BUILD_COMMANDS, which XROOTD doesn't have, it only has an explicit INSTALL_COMMAND.
Without these explicit commands it seems to work better.

For FREETYPE I saw no difference until I changed LOG_CONFIGURE 0 instead of LOG_CONFIGURE 1

@bellenot
Copy link
Member

See also the discussion here: https://gitlab.kitware.com/cmake/cmake/-/issues/26398

@andresailer
Copy link
Contributor Author

Ubuntu24 comes with cmake version 3.28.3. (cf. #16654, #16682)

@bellenot
Copy link
Member

Thanks André!

@bellenot
Copy link
Member

bellenot commented Oct 24, 2024

OK, so simply disabling the LOG_CONFIGURE, LOG_BUILD, LOG_INSTALL when using CONFIGURE_COMMAND, BUILD_COMMNAD, INSTALL_COMMAND seems to fix the issue (i.e. no BUILD_JOB_SERVER_AWARE involved), but then we have no log...

@andresailer andresailer changed the title ROOT fails to build many builtins with CMake 3.30 (when building in parallel (-j N) ROOT fails to build many builtins with CMake 3.30 (>=3.28) (when building in parallel (-j N)) Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants