Skip to content

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Sep 30, 2020

This PR is part of the process separation project.


After #19685 started setting LDFLAGS, the INSTALL_RPATH_USE_LINK_PATH cmake option used in the libmultiprocess build no longer works, so it is neccessary to set CMAKE_INSTALL_RPATH as a fallback.

It's unclear currently whether the bad interaction between INSTALL_RPATH_USE_LINK_PATH and LDFLAGS is a bug, but the issue is reported:

Fixes #19981

After bitcoin#19685 started setting LDFLAGS, the INSTALL_RPATH_USE_LINK_PATH cmake
option used in the libmultiprocess build no longer works, so it is neccessary
to set CMAKE_INSTALL_RPATH as a fallback.

It's unclear currently whether the bad interaction between
INSTALL_RPATH_USE_LINK_PATH and LDFLAGS is a bug, but the issue is reported:

  bitcoin#19981 (comment)
  https://discourse.cmake.org/t/install-rpath-use-link-path-not-working-when-cmake-exe-linker-flags-ldflags-is-set/1892

Commands useful for building / testing this change

  make -C depends MULTIPROCESS=1 print-libmultiprocess_cmake
  make -C depends MULTIPROCESS=1 print-native_libmultiprocess_cmake
  make -C depends MULTIPROCESS=1 HOST=x86_64-apple-darwin16 print-libmultiprocess_cmake

  rm -rvf depends/x86_64-pc-linux-gnu/native depends/work/staging depends/work/build
  make -C depends MULTIPROCESS=1 V=1 native_libmultiprocess_staged
  for f in `find -name mpgen`; do echo == $f ==; readelf -d $f | grep -i path; done

  make -C depends MULTIPROCESS=1 V=1 native_libmultiprocess_built
  find -name CMakeCache.txt

Fixes bitcoin#19981
@ryanofsky
Copy link
Contributor Author

This commit was originally part of #19160 but I'm making it a standalone PR because it seems to be causing travis timeouts on the macOS 10.12 build that I don't know how to fix:

@ryanofsky
Copy link
Contributor Author

Reproduced the travis macOS 10.12 timeout again:

@MarcoFalke do you know any way to debug or fix this? I don't think this PR is actually changing the build results. I think maybe all it is doing is invalidating the travis cache, and that macOS 10.12 travis build is too slow to update the cache. Does this sound right?

@maflcko
Copy link
Member

maflcko commented Sep 30, 2020

The build is probably failing altogether. For temporary debugging, you can remove the &> "/dev/null". Though, the &> "/dev/null" can't be removed from master, because other builds would fail on travis due to too much output.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 30, 2020
@ryanofsky
Copy link
Contributor Author

Thanks @MarcoFalke! It still looks to me that this PR might be uncovering a pre-existing problem with the macOS 10.12 build, and not actually causing the failure. Removing >/dev/null in d9dc091 shows the error "configure: error: Qt5Core >= 5.5.1 not found" (https://travis-ci.org/github/bitcoin/bitcoin/jobs/731743605#L2010) with debug output:

configure:27263: checking for QT_CORE
configure:27270: $PKG_CONFIG --exists --print-errors "${qt_lib_prefix}Core $qt_version"
Package Qt5Core was not found in the pkg-config search path.
Perhaps you should add the directory containing `Qt5Core.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Qt5Core' found
configure:27273: $? = 1
configure:27287: $PKG_CONFIG --exists --print-errors "${qt_lib_prefix}Core $qt_version"
Package Qt5Core was not found in the pkg-config search path.
Perhaps you should add the directory containing `Qt5Core.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Qt5Core' found
configure:27290: $? = 1
configure:27304: result: no
No package 'Qt5Core' found
configure:27329: error: Qt5Core >= 5.5.1 not found

(https://travis-ci.org/github/bitcoin/bitcoin/jobs/731743605#L5266)

It's good to have a starting point for debugging this, but am I wrong that this problem could be happening in master but masked by travis caching?

@dongcarl's PR #19683 also has a failing macOS 10.12 build https://travis-ci.org/github/bitcoin/bitcoin/jobs/730372585, but it seems to be failing with a different problem a little earlier so it's unclear if this Qt5Core error would happen there

@dongcarl
Copy link
Contributor

FWIW I'm fairly certain the failure in #19683 is unrelated. As it's due to over-specifying -fuse-ld= which clang treats as a -Wunused-command-line-argument warning, but because we also have -Werror on, it turns into an error.

@ryanofsky
Copy link
Contributor Author

FWIW I'm fairly certain the failure in #19683 is unrelated. As it's due to over-specifying -fuse-ld= which clang treats as a -Wunused-command-line-argument warning, but because we also have -Werror on, it turns into an error.

I'm also sure it's unrelated. But since it happens before my error, if you fix it you might see the same problem there

@ryanofsky
Copy link
Contributor Author

It does appear the Qt5Core error is not related to the change in this PR. If I revert the original commit da6c9b7, and just add a comment to funcs.mk 7472ee7, the error still happens: configure: error: Qt5Core >= 5.5.1 not found:

However, it turns out the Qt5Core error isn't limited to the macOS 10.12 build, but also happens on the CentOS 7 build:

Which suggests the Qt5Core error is not related to the original macOS 10.12 timeouts #20046 (comment) and #20046 (comment), but maybe is caused by removing >/dev/null in d9dc091, or maybe is caused by more recent changes to master, or caused by other changes on travis. I guess I will try reverting the >/dev/null change d9dc091 to see if the timeout returns.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 1, 2020
@ryanofsky
Copy link
Contributor Author

ryanofsky commented Oct 1, 2020

I think I see why the Qt5Core error is happening. I was trying to debug in d9dc091 by replacing source ./ci/test/05_before_script.sh &> "/dev/null" with source ./ci/test/05_before_script.sh &, but actually I need to drop the trailing & character, otherwise the before_script command doesn't block at all.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 1, 2020
@ryanofsky ryanofsky force-pushed the pr/ipc-rpath branch 2 times, most recently from e5d6dd0 to 9fe5c42 Compare October 1, 2020 02:29
@ryanofsky
Copy link
Contributor Author

ryanofsky commented Oct 1, 2020

After pushing e5d6dd0, was able to reproduce the original macOS 10.12 error and get debug information: https://travis-ci.org/github/bitcoin/bitcoin/jobs/731786312#L4517. The error was CMake Error: TRY_RUN() invoked in cross-compiling mode building the native_cdrkit package


Added 1 commits da6c9b7 -> d9dc091 (pr/ipc-rpath.1 -> pr/ipc-rpath.2, compare) removing >/dev/null to try to debug macOS 10.12 timeout #20046 (comment)
Added 2 commits d9dc091 -> 7472ee7 (pr/ipc-rpath.2 -> pr/ipc-rpath.3, compare) reverting rpath fix to try to debug new Qt5Core error #20046 (comment)
Added 1 commits 7472ee7 -> 9aa445d (pr/ipc-rpath.3 -> pr/ipc-rpath.4, compare) adding back >/dev/null to try to reproduce original timeout
Updated 9aa445d -> e5d6dd0 (pr/ipc-rpath.4 -> pr/ipc-rpath.5, compare) restoring original fix and removing >/dev/null correctly to debug the timeout #20046 (comment)
Updated e5d6dd0 -> 9fe5c42 (pr/ipc-rpath.5 -> pr/ipc-rpath.6, compare) with fix for native_cdrkit error https://travis-ci.org/github/bitcoin/bitcoin/jobs/731786312#L4517
Updated 9fe5c42 -> 3c51b6a (pr/ipc-rpath.6 -> pr/ipc-rpath.7, compare) fixing broken rpath error fix error https://travis-ci.org/github/bitcoin/bitcoin/jobs/731808080#L2547-L2548 in #19160 pr/ipc-echo.15
Updated 3c51b6a -> 7d0271b (pr/ipc-rpath.7 -> pr/ipc-rpath.8, compare) tweaking cmake config to limit rpath override

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 1, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 2, 2020

Gitian builds

File commit 3487e42
(master)
commit 6ca87c6
(master and this pull)
*-aarch64-linux-gnu-debug.tar.gz 610763669e7e3cb7... 34335c1e8d7c8334...
*-aarch64-linux-gnu.tar.gz 51812ca091622ed9... 9c28ba334251bf91...
*-arm-linux-gnueabihf-debug.tar.gz f93c0427cd047290... 7500d6627c1f5d96...
*-arm-linux-gnueabihf.tar.gz 6df65db3f3a7a123... e1079a63632749a8...
*-osx-unsigned.dmg 0d4a4bf011b2019e... e389a17592bf3da8...
*-osx64.tar.gz 0aa9fd6f4187d33f... 0719471b1851b0db...
*-riscv64-linux-gnu-debug.tar.gz 58914f8feac72537... 3469a5e1ef37600b...
*-riscv64-linux-gnu.tar.gz 1a30336e17f7cd6b... 070aa8c518addc1d...
*-win64-debug.zip 2f06f34ffd627e79... 66bbfe781d22f8b0...
*-win64-setup-unsigned.exe f23026e90602164d... 8ee1517a5e05a3df...
*-win64.zip 8d3acee5e2584d3b... ae101a767508cf73...
*-x86_64-linux-gnu-debug.tar.gz be688faf54cfea87... 90d8f0aa5ced4381...
*-x86_64-linux-gnu.tar.gz 2a78323df8c70758... 1fadb805aa18d8eb...
*.tar.gz 7bf0d038afb59072... 0915bc0d2f202929...
bitcoin-core-linux-0.21-res.yml 2b37aee7c44927ee... d0bd019eaeef4cd4...
bitcoin-core-osx-0.21-res.yml 1c3793321abc2f61... 489d46caee641f4b...
bitcoin-core-win-0.21-res.yml 5de911b923fdda5a... 34e1cee7250d0138...
linux-build.log e44bb3ce2f5117e8... 10779661ef8ad566...
osx-build.log 886fd63ccaf3e7cb... 58b0dc61ae802c92...
win-build.log aba8b79f48c7ff90... 8d4b348a363c1911...
bitcoin-core-linux-0.21-res.yml.diff a10d0e2d2753becd...
bitcoin-core-osx-0.21-res.yml.diff 2c17567462e15e52...
bitcoin-core-win-0.21-res.yml.diff 5c3ba0cf9ba80491...
linux-build.log.diff 60d9663e736179aa...
osx-build.log.diff 7eb479dc55998ed3...
win-build.log.diff 713007ccf7760687...

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 3, 2020

Guix builds

File commit 171cd05
(master)
commit 0dc72ad
(master and this pull)
*-aarch64-linux-gnu-debug.tar.gz 2544005fe8e12a29... d132c023c3ef144c...
*-aarch64-linux-gnu.tar.gz 6a64024f047f6712... c8f6b3ca54c4ea4f...
*-arm-linux-gnueabihf-debug.tar.gz 34af46c61f85885e... 1f7a01c83b78bacb...
*-arm-linux-gnueabihf.tar.gz 8ccbac1b22d99093... 59d5d4e89b063dd2...
*-riscv64-linux-gnu-debug.tar.gz c24e7fb442464ab4... c4cbfc6ec3386cf2...
*-riscv64-linux-gnu.tar.gz 19e8824a0d747eb8... c81c7d3b3dce06ec...
*-win-unsigned.tar.gz e308beda6da7bc73... f02ccf2ab477aecf...
*-win64-debug.zip b938748c10c3494d... b5b13543a1c3aad6...
*-win64-setup-unsigned.exe 7e55497679c1410e... ca289a2ac5531559...
*-win64.zip 92faca401d04a85a... 53b6372cf67c2e3b...
*-x86_64-linux-gnu-debug.tar.gz 98c8d82ec5cb3b56... cd7ae692c4fbe91e...
*-x86_64-linux-gnu.tar.gz d7e27b4109831a9d... bd41242f1f983a32...
*.tar.gz 5218235aa0573680... a18d431f4a2adc2b...
guix_build.log 68ca6f0f5067a4a6... c4e072bf6c67c11f...
guix_build.log.diff 3d6dc7810b496376...

@ryanofsky ryanofsky requested a review from fanquake December 8, 2020 16:15
@fanquake
Copy link
Member

fanquake commented Dec 9, 2020

ACK 7d0271b - I haven't looked in depth, but I've re-read through #19981 and checked the failure by testing #19160 (with this reverted):

  CXX      bitcoin_node-bitcoind.o
  CXX      init/bitcoin_node-bitcoin-node.o
  GEN      ipc/capnp/echo.capnp.c++
/home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/native/bin/mpgen: error while loading shared libraries: libcapnpc-0.7.0.so: cannot open shared object file: No such file or directory
make[2]: *** [/home/ubuntu/bitcoin/depends/x86_64-pc-linux-gnu/native/include/mpgen.mk:4: ipc/capnp/echo.capnp.c++] Error 127

Hopefully our upstream issue will get a reply at some point. Will wait for Carl to comment.

@ryanofsky
Copy link
Contributor Author

Thanks for looking fanquake. Note original version of this PR was more complicated and ugly. Now that it's is just setting CMAKE_INSTALL_RPATH for native packages, I think it's pretty clean and straightforward. It may even a be good thing to set rpath explicitly and be clear the build looks for depends libraries ahead of system libraries

@dongcarl
Copy link
Contributor

dongcarl commented Dec 9, 2020

ACK 7d0271b Looked into this a bit, it makes sense that for the things we build in depends, we want the library search to start in depends. It seems reasonable to expect this to happen automatically when CMAKE_INSTALL_PREFIX and INSTALL_RPATH_USE_LINK_PATH are set, but oh well...


I looked into the CMake codebase a bit, but couldn't find a definite culprit for the weird CMAKE_INSTALL_RPATH_USE_LINK_PATH behaviour. It seems unintended, but we'll see what the forums say I guess.

@fanquake fanquake merged commit 17918a9 into bitcoin:master Dec 10, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 10, 2020
…ages

7d0271b depends: Set CMAKE_INSTALL_RPATH for native packages (Russell Yanofsky)

Pull request description:

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

  ---

  After bitcoin#19685 started setting `LDFLAGS`, the `INSTALL_RPATH_USE_LINK_PATH` cmake option used in the libmultiprocess build no longer works, so it is neccessary to set `CMAKE_INSTALL_RPATH` as a fallback.

  It's unclear currently whether the bad interaction between `INSTALL_RPATH_USE_LINK_PATH` and `LDFLAGS` is a bug, but the issue is reported:

  - bitcoin#19981 (comment)
  - https://discourse.cmake.org/t/install-rpath-use-link-path-not-working-when-cmake-exe-linker-flags-ldflags-is-set/1892

  Fixes bitcoin#19981

ACKs for top commit:
  fanquake:
    ACK 7d0271b - I haven't looked in depth, but I've re-read through bitcoin#19981 and checked the failure by testing bitcoin#19160 (with this reverted):
  dongcarl:
    ACK 7d0271b Looked into this a bit, it makes sense that for the things we build in depends, we want the library search to start in depends. It seems reasonable to expect this to happen automatically when `CMAKE_INSTALL_PREFIX` and `INSTALL_RPATH_USE_LINK_PATH` are set, but oh well...

Tree-SHA512: 97cc5801c3204c14cd33004423631456ca0701e2127ee5146810a76e2f4aac9de1f4b5437402a4329cda54e022dc99270fee7e38c2995765f36b3848215fa78e
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging this pull request may close these issues.

Issue with mpgen and RUNPATH
5 participants