Skip to content

Fix libbsd linking problem with builtin_llvm=OFF#12154

Closed
stephanlachnit wants to merge 3 commits intoroot-project:masterfrom
stephanlachnit:p-fix-12152
Closed

Fix libbsd linking problem with builtin_llvm=OFF#12154
stephanlachnit wants to merge 3 commits intoroot-project:masterfrom
stephanlachnit:p-fix-12152

Conversation

@stephanlachnit
Copy link
Copy Markdown
Contributor

@stephanlachnit stephanlachnit commented Jan 29, 2023

Signed-off-by: Stephan Lachnit stephanlachnit@debian.org

This Pull request:

Changes or fixes:

Fix for #12152. Requires #12153.

The idea is the following:

  • add libbsd option & find_packge module defining LIBBSD::libbsd target
  • define R__USE_LIBBSD in RConfigure.h if libbsd enabled
  • adjust strlcpy to include bsd/string.h if R__USE_LIBBSD defined
  • add LIBBSD::libbsd to the public linking interface of Clib

Unfortunately, this does not work. The reason here is that (for some reason beyond me) rootcling_stage1, libCling.so, bin/root and probably more don't link to Clib as target but instead fetch the target object directly.

Relevant CMake documentation:

Example using rootcling_stage1:

Currently in CMake:

ROOT_EXECUTABLE(rootcling_stage1 src/rootcling_stage1.cxx
                              $<TARGET_OBJECTS:Clib>
                              $<TARGET_OBJECTS:ClingUtils>
                              $<TARGET_OBJECTS:Dictgen>
                              $<TARGET_OBJECTS:Foundation_Stage1>
                              LIBRARIES ${CLING_LIBRARIES} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${ROOT_ATOMIC_LIBS}
                              NOINSTALL)

I link against the Clib object library, but ignores any target properties like for example this line:

# alternative for strlcpy on linux, see https://github.com/root-project/root/issues/12152
if(libbsd)
  target_link_libraries(Clib PUBLIC LIBBSD::libbsd)
endif()

I don't see why using the Clib target directly should break anything? It's linked also directly, the only difference is that target properties are ignored which shouldn't be the case.

I added a commit with this approach and it seems to work.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #12152.

@phsft-bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@stephanlachnit
Copy link
Copy Markdown
Contributor Author

Works with builtin_llvm=ON & libbsd=ON now

@Axel-Naumann
Copy link
Copy Markdown
Member

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac12/noimt, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on mac12/noimt.
Running on macphsft18.dyndns.cern.ch:/Users/sftnight/build/jenkins/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2023-01-30T14:28:17.499Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/core/base/src/TDirectory.cxx:1292:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac12/noimt, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/cxx14
How to customize builds

Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/cxx14
How to customize builds

@stephanlachnit stephanlachnit marked this pull request as ready for review July 31, 2023 20:31
@stephanlachnit
Copy link
Copy Markdown
Contributor Author

stephanlachnit commented Jul 31, 2023

I tested this now in a working ROOT install and it seems to work just fine.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/nortcxxmod.
Running on root-ubuntu-2204-3.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

@github-actions
Copy link
Copy Markdown

Test Results

         8 files           8 suites   1d 18h 40m 37s ⏱️
  2 475 tests   2 467 ✔️ 0 💤 8
18 752 runs  18 744 ✔️ 0 💤 8

For more details on these failures, see this check.

Results for commit 8929db8.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/soversion.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@stephanlachnit stephanlachnit marked this pull request as draft August 2, 2023 13:30
@stephanlachnit stephanlachnit marked this pull request as ready for review August 2, 2023 15:58
@stephanlachnit stephanlachnit marked this pull request as draft August 6, 2023 16:11
@stephanlachnit
Copy link
Copy Markdown
Contributor Author

When using this in externals projects, this happens:

The link interface of target "ROOT::Core" contains:

  PkgConfig::LIBBSD

but the target was not found.

Should be reasonably easy to fix.

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/default
How to customize builds

@stephanlachnit
Copy link
Copy Markdown
Contributor Author

Should be reasonably easy to fix.

Fixed but closing since not required anymore with #13420.

@stephanlachnit stephanlachnit deleted the p-fix-12152 branch August 8, 2023 21:17
@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2023-08-08T21:19:05.964Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1144 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/default.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2023-08-08T21:19:10.432Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1144 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/soversion.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Errors:

  • [2023-08-08T21:44:58.391Z] CMake Error at /data/sftnight/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1144 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11/noimt.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2023-08-08T21:51:37.801Z] CMake Error at /Users/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1144 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/nortcxxmod.
Running on root-ubuntu-2204-3.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

@phsft-bot
Copy link
Copy Markdown

Build failed on mac12arm/cxx20.
Running on macphsft26.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2023-08-08T22:37:43.744Z] CMake Error at /Users/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1144 (message):

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

Successfully merging this pull request may close these issues.

Building fails with builtin_llvm=OFF due to unintend libbsd linking

4 participants