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

Errors building on Amazon Linux (centos based) #695

Closed
AdvancedStyle opened this issue Jan 21, 2018 · 19 comments
Closed

Errors building on Amazon Linux (centos based) #695

AdvancedStyle opened this issue Jan 21, 2018 · 19 comments

Comments

@AdvancedStyle
Copy link

I'm getting this error when trying to make on Amazon linux; is there a dependency I'm missing?

lear ctest/test_clear-test_clear.o -Wl,--whole-archive -Wl,secp256k1/.libs/libsecp256k1.a -Wl,--no-whole-archive  ./.libs/libwallycore.a -pthread
/tmp/ccR62PS0.ltrans0.ltrans.o: In function `run_tests':
<artificial>:(.text+0x203): undefined reference to `bip39_mnemonic_to_bytes'
<artificial>:(.text+0x266): undefined reference to `bip39_mnemonic_validate'
/tmp/ccR62PS0.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x3c): undefined reference to `wally_bzero'
<artificial>:(.text.startup+0x66): undefined reference to `wally_bzero'
collect2: error: ld returned 1 exit status
make[4]: *** [test_clear] Error 1
make[4]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bitcoin/lightning/external/libwally-core'
make: *** [external/libwally-core/src/secp256k1/libsecp256k1.la] Error 2
rm external/libwally-core/src/secp256k1/libsecp256k1.la

@cdecker
Copy link
Member

cdecker commented Jan 21, 2018

Which compiler is the machine using?

@AdvancedStyle
Copy link
Author

gcc --version
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)

@cdecker
Copy link
Member

cdecker commented Jan 21, 2018

We've been compiling it with gcc 5.4.0 and clang 3.8.0, it could be that some options need to be adjusted for newer compilers.

@AdvancedStyle
Copy link
Author

AdvancedStyle commented Jan 21, 2018

I've tried now with gcc 5.4.0 but get this error:

/bin/sh ../libtool  --tag=CC   --mode=link /usr/local/gcc/5.4.0/bin/gcc -I../include -pthread -O3 -D_FORTIFY_SOURCE=1 -fstack-protector-strong -DNDEBUG=1 -flto -flax-vector-conversions -Wall -Wextra -Wpedantic -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -Wformat -Wformat-security -Wformat-nonliteral -fvisibility=hidden   -O3 -flto -Wl,-z,relro -o test_clear ctest/test_clear-test_clear.o libwallycore.la -Wl,--whole-archive,secp256k1/.libs/libsecp256k1.a,--no-whole-archive
libtool: link: /usr/local/gcc/5.4.0/bin/gcc -I../include -pthread -O3 -D_FORTIFY_SOURCE=1 -fstack-protector-strong -DNDEBUG=1 -flto -flax-vector-conversions -Wall -Wextra -Wpedantic -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -Wformat -Wformat-security -Wformat-nonliteral -fvisibility=hidden -O3 -flto -Wl,-z -Wl,relro -o test_clear ctest/test_clear-test_clear.o -Wl,--whole-archive -Wl,secp256k1/.libs/libsecp256k1.a -Wl,--no-whole-archive  ./.libs/libwallycore.a -pthread
lto1: fatal error: bytecode stream generated with LTO version 6.0 instead of the expected 4.1
compilation terminated.
lto-wrapper: fatal error: /usr/local/gcc/5.4.0/bin/gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[4]: *** [test_clear] Error 1
make[4]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bitcoin/lightning/external/libwally-core'
make: *** [external/libwally-core/src/secp256k1/libsecp256k1.la] Error 2
rm external/libwally-core/src/secp256k1/libsecp256k1.la

@cdecker
Copy link
Member

cdecker commented Jan 21, 2018

Yep, you might need to run make distclean to clean the dependencies that are now partially built with the newer compiler. The libwally maintainers are currently contemplating whether to remove LTO altogether since it seems rather unstable in most compilers.

@nstamato
Copy link

Interestingly I got the exact same error on another RedHat flavored distro (Fedora) when I tried to compile but didn't look further into it as it was a very old version of Fedora. How old is your version?

FYI, I've been compiling just fine with gcc 7.2.0 on ubuntu with no tweaks to Makefiles or otherwise.

@AdvancedStyle
Copy link
Author

I did with make disclean, and now it's back to the original error (but with gcc 5.4.0):

make[4]: Entering directory `/home/bitcoin/lightning/external/libwally-core/src'
/bin/sh ../libtool  --tag=CC   --mode=link /usr/local/gcc/5.4.0/bin/gcc -I../include -pthread -O3 -D_FORTIFY_SOURCE=1 -fstack-protector-strong -DNDEBUG=1 -flto -flax-vector-conversions -Wall -Wextra -Wpedantic -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -Wformat -Wformat-security -Wformat-nonliteral -fvisibility=hidden   -O3 -flto -Wl,-z,relro -o test_clear ctest/test_clear-test_clear.o libwallycore.la -Wl,--whole-archive,secp256k1/.libs/libsecp256k1.a,--no-whole-archive
libtool: link: /usr/local/gcc/5.4.0/bin/gcc -I../include -pthread -O3 -D_FORTIFY_SOURCE=1 -fstack-protector-strong -DNDEBUG=1 -flto -flax-vector-conversions -Wall -Wextra -Wpedantic -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -Wformat -Wformat-security -Wformat-nonliteral -fvisibility=hidden -O3 -flto -Wl,-z -Wl,relro -o test_clear ctest/test_clear-test_clear.o -Wl,--whole-archive -Wl,secp256k1/.libs/libsecp256k1.a -Wl,--no-whole-archive  ./.libs/libwallycore.a -pthread
/tmp/ccJe0l2j.ltrans0.ltrans.o: In function `run_tests':
<artificial>:(.text+0x204): undefined reference to `bip39_mnemonic_to_bytes'
<artificial>:(.text+0x266): undefined reference to `bip39_mnemonic_validate'
/tmp/ccJe0l2j.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x3c): undefined reference to `wally_bzero'
<artificial>:(.text.startup+0x66): undefined reference to `wally_bzero'
collect2: error: ld returned 1 exit status
make[4]: *** [test_clear] Error 1
make[4]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/bitcoin/lightning/external/libwally-core/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bitcoin/lightning/external/libwally-core'
make: *** [external/libwally-core/src/secp256k1/libsecp256k1.la] Error 2
rm external/libwally-core/src/secp256k1/libsecp256k1.la

cat /proc/version

Linux version 4.9.76-3.78.amzn1.x86_64 (mockbuild@gobi-build-60009)

@dongcarl
Copy link
Contributor

Funny enough, I'm getting the same error on FreeBSD.

@rustyrussell
Copy link
Contributor

I've filed a bug referring to this one on libwally-core...

@dongcarl
Copy link
Contributor

dongcarl commented Jan 22, 2018

Some findings on the undefined reference to 'bip39_mnemonic_to_bytes' issue:

  1. This issue dissapears if you compile using clang as stated in the libwally-core repository README
  2. This issue is still there on master in the libwally-core repository

@AdvancedStyle @rustyrussell

@dongcarl
Copy link
Contributor

@AdvancedStyle You should be able to build successfully using clang by setting CC and CXX.

@Raulo
Copy link

Raulo commented Jan 27, 2018

I have a slightly different (but perhaps related) compilation error on master d03ca59
with Ubuntu 16.04 and gcc

hsmd/hsm.o: In function handle_ecdh': $HOME/tmp/lightningnetwork/lightning/hsmd/hsm.c:134: undefined reference to secp256k1_ecdh'
collect2: error: ld returned 1 exit status
Makefile:271: recipe for target 'lightningd/lightning_hsmd' failed
make: *** [lightningd/lightning_hsmd] Error 1
rm external/libwally-core/src/secp256k1/libsecp256k1.la

$ cc --version
cc (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04) 6.3.0 20170519

@windsok
Copy link
Contributor

windsok commented Jan 30, 2018

I've had no problems compiling the latest master on a Fedora system with GCC 6.4.1

@dongcarl
Copy link
Contributor

#819 should have fixed most build problems. @Raulo can you try with latest master?

@cdecker
Copy link
Member

cdecker commented Jan 31, 2018

Yep, I think we can close this for now, feel free to reopen if not fixed 😉

@cdecker cdecker closed this as completed Jan 31, 2018
@Sosthene00
Copy link

Hi, I ran unto what seems to be a very similar issue while making :

if git submodule status external/libwally-core | grep -q '^[-+]'; then rm -rf external/libwally-core; git submodule update --init external/libwally-core; fi if git submodule status external/libsodium | grep -q '^[-+]'; then rm -rf external/libsodium; git submodule update --init external/libsodium; fi if git submodule status external/jsmn | grep -q '^[-+]'; then rm -rf external/jsmn; git submodule update --init external/jsmn; fi if git submodule status external/libbase58 | grep -q '^[-+]'; then rm -rf external/libbase58; git submodule update --init external/libbase58; fi if git submodule status external/libbacktrace | grep -q '^[-+]'; then rm -rf external/libbacktrace; git submodule update --init external/libbacktrace; fi cc -L/usr/local/lib hsmd/hsm.o hsmd/gen_hsm_client_wire.o common/bip32.o common/daemon_conn.o common/derive_basepoints.o common/funding_tx.o common/hash_u5.o common/io_debug.o common/key_derive.o common/msg_queue.o common/permute_tx.o common/status.o common/subdaemon.o common/type_to_string.o common/utils.o common/utxo.o common/version.o common/withdraw_tx.o bitcoin/base58.o bitcoin/block.o bitcoin/chainparams.o bitcoin/locktime.o bitcoin/pubkey.o bitcoin/pullpush.o bitcoin/script.o bitcoin/shadouble.o bitcoin/short_channel_id.o bitcoin/signature.o bitcoin/tx.o bitcoin/varint.o wire/wire_sync.o wire/wire_io.o wire/fromwire.o wire/peer_wire.o wire/towire.o wire/gen_peer_wire.o ccan-asort.o ccan-autodata.o ccan-breakpoint.o ccan-crypto-hmac.o ccan-crypto-hkdf.o ccan-crypto-ripemd160.o ccan-crypto-sha256.o ccan-crypto-shachain.o ccan-crypto-siphash24.o ccan-err.o ccan-fdpass.o ccan-htable.o ccan-ilog.o ccan-io-io.o ccan-intmap.o ccan-io-poll.o ccan-io-fdpass.o ccan-isaac.o ccan-isaac64.o ccan-list.o ccan-mem.o ccan-noerr.o ccan-opt-helpers.o ccan-opt-parse.o ccan-opt-usage.o ccan-opt.o ccan-pipecmd.o ccan-ptr_valid.o ccan-read_write_all.o ccan-str-hex.o ccan-str.o ccan-take.o ccan-tal-grab_file.o ccan-tal-path.o ccan-tal-str.o ccan-tal.o ccan-time.o ccan-timer.o -Lexternal -lwallycore -lsecp256k1 -lsodium -ljsmn -lbase58 -lbacktrace -lm -lgmp -lsqlite3 -o lightningd/lightning_hsmd hsmd/hsm.o : Dans la fonction « handle_ecdh » : /home/sosthene/lightning/hsmd/hsm.c:134 : référence indéfinie vers « secp256k1_ecdh » collect2: error: ld returned 1 exit status Makefile:271 : la recette pour la cible « lightningd/lightning_hsmd » a échouée make: *** [lightningd/lightning_hsmd] Erreur 1
I use GCC version 5.4.0 :
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.6) 5.4.0 20160609

cat proc/version :
Linux version 4.4.0-21-generic (buildd@lgw01-21) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) ) #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016

Can you help me make it out ? Thanks !

@billygarrison
Copy link
Contributor

I'm also having a very similar error with both gcc and clang compilers.

/usr/bin/clang -L/usr/local/lib   hsmd/hsm.o hsmd/gen_hsm_client_wire.o common/bip32.o common/daemon_conn.o common/derive_basepoints.o common/funding_tx.o common/gen_status_wire.o common/hash_u5.o common/io_debug.o common/key_derive.o common/msg_queue.o common/permute_tx.o common/status.o common/status_wire.o common/subdaemon.o common/type_to_string.o common/utils.o common/utxo.o common/version.o common/withdraw_tx.o bitcoin/base58.o bitcoin/block.o bitcoin/chainparams.o bitcoin/locktime.o bitcoin/pubkey.o bitcoin/pullpush.o bitcoin/script.o bitcoin/shadouble.o bitcoin/short_channel_id.o bitcoin/signature.o bitcoin/tx.o bitcoin/varint.o wire/wire_sync.o wire/wire_io.o wire/fromwire.o wire/peer_wire.o wire/towire.o wire/gen_peer_wire.o ccan-asort.o ccan-autodata.o ccan-breakpoint.o ccan-crypto-hmac.o ccan-crypto-hkdf.o ccan-crypto-ripemd160.o ccan-crypto-sha256.o ccan-crypto-shachain.o ccan-crypto-siphash24.o ccan-daemonize.o ccan-err.o ccan-fdpass.o ccan-htable.o ccan-ilog.o ccan-io-io.o ccan-intmap.o ccan-io-poll.o ccan-io-fdpass.o ccan-isaac.o ccan-isaac64.o ccan-list.o ccan-mem.o ccan-noerr.o ccan-opt-helpers.o ccan-opt-parse.o ccan-opt-usage.o ccan-opt.o ccan-pipecmd.o ccan-ptr_valid.o ccan-read_write_all.o ccan-str-hex.o ccan-str.o ccan-take.o ccan-tal-grab_file.o ccan-tal-link.o ccan-tal-path.o ccan-tal-str.o ccan-tal.o ccan-time.o ccan-timer.o  -Lexternal -lwallycore -lsecp256k1 -lsodium -ljsmn -lbase58 -lbacktrace -lm -lgmp -lsqlite3  -o lightningd/lightning_hsmd
hsmd/hsm.o: In function `handle_ecdh':
/home/billy/builds/lightning/hsmd/hsm.c:135: undefined reference to `secp256k1_ecdh'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:280: recipe for target 'lightningd/lightning_hsmd' failed
make: *** [lightningd/lightning_hsmd] Error 1
rm external/libwally-core/src/secp256k1/libsecp256k1.la

cat /proc/version:
Linux version 4.13.0-32-generic (buildd@lgw01-amd64-016) (gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)) #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018

@cdecker
Copy link
Member

cdecker commented Feb 21, 2018

@BobleChinois and @blockchainbilly those failures indicate a failure when compiling the hsm, not libwally as the previous issue. Could you open a new issue for this?

@Sosthene00
Copy link

@cdecker Done, issue #1069 , thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants