Sjors / libwally-swift

Swift wrapper for LibWally, a collection of useful primitives for cryptocurrency wallets
MIT License
40 stars 18 forks source link

Error building libwally-swift with libtool@2.4.7 #59

Closed jurvis closed 2 years ago

jurvis commented 2 years ago

When running./build-libwally.sh -dsc / pod install, I am getting the following errors:

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in secp256k1
gcc -DHAVE_CONFIG_H -I. -I./src -O2  -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-overlength-strings -Wall -Wno-unused-function -Wextra -Wcast-align -Wconditional-uninitialized -fvisibility=hidden -g -O2 -c src/gen_context.c -o gen_context.o
gcc -O2  -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-overlength-strings -Wall -Wno-unused-function -Wextra -Wcast-align -Wconditional-uninitialized -fvisibility=hidden -g -O2  gen_context.o -o gen_context
./gen_context
  CC       src/libsecp256k1_la-secp256k1.lo
./libtool: line 151: -o: command not found
  CCLD     libsecp256k1.la
./libtool: line 151: -o: command not found
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no output file specified (specify with -o output)

After digging into it, it looks like an issue with a recent update to libtool that affected our ability to build libwally-core (https://github.com/ElementsProject/libwally-core/issues/320).

For anyone encountering this issue, I have a workaround:

brew unlink libtool
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/0fbd6e24c4122e18ade1ec6c5916cb21de14f352/Formula/libtool.rb -o libtool.rb
brew install libtool.rb

This essentially unlinks your current install of libtool@2.4.7, pulls an old formula of libtool (2.4.6_4), and installs that instead. That should fix the build until libwally-core and libwally-swift is updated.

To undo the workaround above,

brew unlink libtool
rm -rf /opt/homebrew/Cellar/libtool/2.4.6_4
brew install libtool

P.S: huge fan of your Bitcoin Explained podcast! Thanks for your work on that and this library! 🙏🏼

Sjors commented 2 years ago

Thanks! I subscribed to the upstream issue so will keep an eye on that. When there's a new libwally-core release I'll publish a new LibWallySwift release too.

jurvis commented 2 years ago

@Sjors sounds good. I've been following the https://github.com/ElementsProject/libwally-core/issues/320 to make sure that it works for our use case. There are a few things I need to tweak in the script related to build architectures, but I should be able to submit a PR for review once I get the time to sit down and figure it out 😄