hebasto / bitcoin

Bitcoin Core integration/staging tree
https://bitcoincore.org/en/download
MIT License
21 stars 5 forks source link

cmake: Fix prefix maps for Guix builds #315

Closed hebasto closed 3 months ago

hebasto commented 3 months ago

Fixes https://github.com/hebasto/bitcoin/issues/297.

CMake uses absolute paths for source files when invoking a compiler. This change makes the resulting Guix binaries location independent.

The resulting behaviour mirrors that of the master branch.


NOTE. On the master branch, HOST_CFLAGS+=" -ffile-prefix-map=${PWD}=." evaluates to HOST_CFLAGS+=" -ffile-prefix-map=/bitcoin=.", which effectively does nothing because there is no such a path among source files being compiled. Binaries appear file path independent because file paths relative to the source directory are used when invoking a compiler.

hebasto commented 3 months ago

cc @maflcko @fanquake @TheCharlatan

m3dwards commented 3 months ago

ACK f32f42d4804161f622af231d44d67f1a55936e82

UPDATE with correct Guix hash. Guix build (x86)

aa1e42713c6ab422468037ea2343d0577abd8098dd4c312c976896c49694631e  guix-build-f32f42d48041/output/dist-archive/bitcoin-f32f42d48041.tar.gz
ee934421cf193d49b691dff53fbcdd99f7d118592e2a5b2311407a3fb949964d  guix-build-f32f42d48041/output/x86_64-linux-gnu/SHA256SUMS.part
978f93c5500dd3841710ad0b419dd27c99b9f661319c8d324f74e2b0b84b9124  guix-build-f32f42d48041/output/x86_64-linux-gnu/bitcoin-f32f42d48041-x86_64-linux-gnu-debug.tar.gz
47e4c53d4788d2328d499c3df9bf762d9566acfc9294e68b77f3673fd89a3ee1  guix-build-f32f42d48041/output/x86_64-linux-gnu/bitcoin-f32f42d48041-x86_64-linux-gnu.tar.gz

Was able to run bitcoind built via Guix

maflcko commented 3 months ago

Was able to run bitcoind built via Guix

Did you also test the behavior that this is supposed to fix?

maflcko commented 3 months ago

That is, what is the output of ./bitcoin-ec5d1c372b20/bin/bitcoind -datadir=/tmp -regtest -printtoconsole -logsourcelocations -asmap=/tmp/no_file?

hebasto commented 3 months ago

That is, what is the output of ./bitcoin-ec5d1c372b20/bin/bitcoind -datadir=/tmp -regtest -printtoconsole -logsourcelocations -asmap=/tmp/no_file?

I'd rather expect the output of ./bitcoin-f32f42d48041/bin/bitcoind -datadir=/tmp -regtest -printtoconsole -logsourcelocations -asmap=/tmp/no_file (note the hash)

:)

m3dwards commented 3 months ago
./bitcoin-f32f42d48041/bin/bitcoind -datadir=/tmp -regtest -printtoconsole -logsourcelocations -asmap=/tmp/no_file
2024-08-10T10:00:00Z [init/common.cpp:149] [LogPackageVersion] Bitcoin Core version v27.99.0-gf32f42d4804161f622af231d44d67f1a55936e82 (release build)
2024-08-10T10:00:00Z [node/chainstatemanager_args.cpp:57] [ApplyArgsManOptions] Script verification uses 15 additional threads
2024-08-10T10:00:00Z [kernel/context.cpp:20] [operator()] Using the 'sse4(1way),sse41(4way)' SHA256 implementation
2024-08-10T10:00:00Z [random.cpp:114] [ReportHardwareRand] Using RdSeed as an additional entropy source
2024-08-10T10:00:00Z [random.cpp:117] [ReportHardwareRand] Using RdRand as an additional entropy source
2024-08-10T10:00:00Z [init/common.cpp:120] [StartLogging] Default data directory /home/max/.bitcoin
2024-08-10T10:00:00Z [init/common.cpp:121] [StartLogging] Using data directory /tmp/regtest
2024-08-10T10:00:00Z [init/common.cpp:132] [StartLogging] Config file: /tmp/bitcoin.conf (not found, skipping)
2024-08-10T10:00:00Z [common/args.cpp:822] [logArgsPrefix] Command-line arg: asmap="/tmp/no_file"
2024-08-10T10:00:00Z [common/args.cpp:822] [logArgsPrefix] Command-line arg: datadir="/tmp"
2024-08-10T10:00:00Z [common/args.cpp:822] [logArgsPrefix] Command-line arg: logsourcelocations=""
2024-08-10T10:00:00Z [common/args.cpp:822] [logArgsPrefix] Command-line arg: printtoconsole=""
2024-08-10T10:00:00Z [common/args.cpp:822] [logArgsPrefix] Command-line arg: regtest=""
2024-08-10T10:00:00Z [init.cpp:1151] [AppInitMain] Using at most 125 automatic connections (1024 file descriptors available)
2024-08-10T10:00:00Z [util/thread.cpp:20] [TraceThread] scheduler thread start
2024-08-10T10:00:00Z [httpserver.cpp:384] [HTTPBindAddresses] Binding RPC on address ::1 port 18443
2024-08-10T10:00:00Z [httpserver.cpp:384] [HTTPBindAddresses] Binding RPC on address 127.0.0.1 port 18443
2024-08-10T10:00:00Z [httprpc.cpp:297] [InitRPCAuthentication] Using random cookie authentication.
2024-08-10T10:00:00Z [rpc/request.cpp:132] [GenerateAuthCookie] Generated RPC authentication cookie /tmp/regtest/.cookie
2024-08-10T10:00:00Z [rpc/request.cpp:133] [GenerateAuthCookie] Permissions used for cookie: rw-------
2024-08-10T10:00:00Z [httpserver.cpp:488] [StartHTTPServer] Starting HTTP server with 4 worker threads
2024-08-10T10:00:00Z [wallet/load.cpp:53] [VerifyWallets] Using wallet directory /tmp/regtest/wallets
2024-08-10T10:00:00Z [noui.cpp:57] [noui_InitMessage] init message: Verifying wallet(s)…
2024-08-10T10:00:00Z [noui.cpp:31] [noui_ThreadSafeMessageBox] [error] Could not find asmap file "/tmp/no_file"
Error: Could not find asmap file "/tmp/no_file"
2024-08-10T10:00:00Z [init.cpp:273] [Shutdown] Shutdown: In progress...
2024-08-10T10:00:00Z [util/thread.cpp:22] [TraceThread] scheduler thread exit
2024-08-10T10:00:00Z [init.cpp:387] [Shutdown] Shutdown: done