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

Error Building from source on MacOS BigSur; linker issues #20825

Closed
jadijadi opened this issue Jan 1, 2021 · 9 comments
Closed

Error Building from source on MacOS BigSur; linker issues #20825

jadijadi opened this issue Jan 1, 2021 · 9 comments
Labels

Comments

@jadijadi
Copy link
Contributor

jadijadi commented Jan 1, 2021

Trying to build the bitcoin core from source on Mac Big Sur based on the doc:

xcode-select --install
brew install automake libtool boost miniupnpc pkg-config python qt libevent qrencode sqlite
git clone https://github.com/bitcoin/bitcoin
cd bitcoin
./autogen.sh
./configure
make

but it breaks with:

Making all in src
  CXXLD    bitcoind
ld: warning: ignoring file libbitcoin_wallet.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libbitcoin_common.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libbitcoin_server.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file univalue/.libs/libunivalue.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libbitcoin_zmq.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libbitcoin_util.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file crypto/libbitcoin_crypto_base.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file crypto/libbitcoin_crypto_avx2.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file crypto/libbitcoin_crypto_shani.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file crypto/libbitcoin_crypto_sse41.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file crc32c/libcrc32c.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file crc32c/libcrc32c_sse42.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file leveldb/libmemenv.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file secp256k1/.libs/libsecp256k1.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libbitcoin_consensus.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file leveldb/libleveldb.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture x86_64:
  "SetupEnvironment()", referenced from:
      _main in bitcoind-bitcoind.o
  "noui_connect()", referenced from:

some info:

➜  bitcoin git:(master) uname -a
Darwin jadis-MacBook-Pro.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec  2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
➜  bitcoin git:(master) make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
➜  bitcoin git:(master) brew -v
Homebrew 2.7.1-108-g1af8203
Homebrew/homebrew-core (git revision c926d5; last commit 2021-01-01)
Homebrew/homebrew-cask (git revision a43760; last commit 2021-01-01)

paste of the ./autogen.sh output: https://pastebin.com/nGctaJGB
paste of the ./configure --without-gui output: https://pastebin.com/HCDyNGGb
paste of the make: https://pastebin.com/0UTVcAUs

config.log

I'm working on this for 2 days with no results and will appreciate any help or more info needed.

EDIT: OS and XCode is updated to the latest version. brew upgrade is done.

@jadijadi jadijadi added the Bug label Jan 1, 2021
@hebasto
Copy link
Member

hebasto commented Jan 1, 2021

Did you try make clean?

@hebasto
Copy link
Member

hebasto commented Jan 1, 2021

Also could you provide the brew list output?

@jadijadi
Copy link
Contributor Author

jadijadi commented Jan 2, 2021

Did you try make clean?

yes. Even cloned in another directory, same issue.

@jadijadi
Copy link
Contributor Author

jadijadi commented Jan 2, 2021

Also could you provide the brew list output?

Sure and thanks for the help.

➜  bitcoin git:(master) brew list
adns				ghc				icu4c				libsodium			openssl@1.1			sip
adwaita-icon-theme		ghostscript			ilmbase				libsoup				opus				snappy
amtk				giflib				imagemagick			libsoxr				p11-kit				speex
aom				git				intltool			libssh2				pandoc				sphinx-doc
aspell				glances				irssi				libtasn1			pango				sqlite
atk				glfw				isl				libtensorflow			pcre				srt
autoconf			glib				iso-codes			libtiff				pcre2				sslscan
automake			glib-networking			jasper				libtool				perl				stoken
axel				gmp				jcal				libunistring			pinentry			task
bdw-gc				gnome-icon-theme		jemalloc			libusb				pixman				taskd
berkeley-db@4			gnu-getopt			jpeg				libusb-compat			pkg-config			tasksh
binutils			gnu-sed				krb5				libvidstab			postgresql			tcpflow
boost				gnu-tar				lame				libvorbis			powerline-go			telnet
c-ares				gnu-which			leptonica			libvpx				privoxy				tepl
cabal-install			gnupg				leveldb				libxml2				protobuf			tesseract
cairo				gnupg2				lftp				libyaml				proxychains-ng			texi2html
cmake				gnutls				libass				links				pth				theora
coreutils			go				libassuan			little-cms2			py2cairo			tmux
cowsay				gobject-introspection		libbluray			lua				py3cairo			tor
cscope				gperftools			libcroco			lzo				pygobject			torsocks
dav1d				gpg-agent			libde265			macvim				pygobject3			tree
diffutils			gradle				libepoxy			makedepend			pygtk				uchardet
dirmngr				graphite2			libev				memcached			python				unbound
docbook				graphviz			libevent			miniupnpc			python3				utf8proc
docbook-xsl			grep				libffi				mitmproxy			python@2			vala
enchant				gsettings-desktop-schemas	libgcrypt			mono				python@3.8			vim
erlang				gspell				libgpg-error			mpfr				python@3.9			watch
ext4fuse			gtk+				libheif				mysql				qrencode			watson
ffmpeg				gtk+3				libidn				ncurses				qt				webp
findutils			gtk-mac-integration		libidn2				nethack				qt@5.7				wget
flac				gtksourceview3			libksba				netpbm				rav1e				wxmac
fontconfig			gtksourceview4			liblqr				nettle				readline			x264
freetype			gtkspell3			libmpc				nghttp2				reattach-to-user-namespace	x265
frei0r				gts				libogg				nmap				redis				xmlto
fribidi				guetzli				libomp				node				rtmpdump			xvid
gcc				guile				libpeas				npth				rubberband			xz
gd				gzip				libpng				openconnect			ruby				yasm
gdb				harfbuzz			libpsl				opencore-amr			rust				youtube-dl
gdbm				heroku				librsvg				openexr				scrcpy				zeromq
gdk-pixbuf			hicolor-icon-theme		libsamplerate			openfortivpn			screenfetch			zsh
gedit				hping				libscrypt			openjdk				sdl2
gettext				htop				libsndfile			openjpeg			shared-mime-info
b                                                                   dnscrypt                                                            osxfuse
➜

@hebasto
Copy link
Member

hebasto commented Jan 2, 2021

From your configure log it follows that non-cctools build tools are used. Make sure that Apple's toolchain is used, e.g.:

% which ranlib
/usr/bin/ranlib
% $(which ranlib) -V
Apple Inc. version cctools-977.1
error: /Library/Developer/CommandLineTools/usr/bin/ranlib: no archives specified
Usage: /Library/Developer/CommandLineTools/usr/bin/ranlib [-sactfqLT] [-] archive [...]

You could try to remove Homebrew's binutils or adjust the $PATH variable (did not check side effects of the latter).

@jadijadi
Copy link
Contributor Author

jadijadi commented Jan 2, 2021

Wow... thanks @hebasto ! This resolved my issue. I would have never able to find it without help. Thanks very much for the help. Really appreciated.

@KevinHock
Copy link

Wow @hebasto thanks for helping me out installing cabal, just found this issue via google search.

@samuel-reyes
Copy link

samuel-reyes commented May 5, 2021

Wow... thanks @hebasto ! This resolved my issue. I would have never able to find it without help. Thanks very much for the help. Really appreciated.

I'm not really sure what he meant, but I'm having the same issue with the i386 error. How did you get it to work? I need a little more elaboration than what @hebasto provided. I'm not super familiar with paths, and my brew doesn't have the package installed he said to remove. So I'm guessing I need to adjust my path? I would appreciate any help :)

@jadijadi

@fzyzcjy
Copy link

fzyzcjy commented Sep 26, 2021

From your configure log it follows that non-cctools build tools are used. Make sure that Apple's toolchain is used, e.g.:

% which ranlib
/usr/bin/ranlib
% $(which ranlib) -V
Apple Inc. version cctools-977.1
error: /Library/Developer/CommandLineTools/usr/bin/ranlib: no archives specified
Usage: /Library/Developer/CommandLineTools/usr/bin/ranlib [-sactfqLT] [-] archive [...]

You could try to remove Homebrew's binutils or adjust the $PATH variable (did not check side effects of the latter).

This helps me compile protobuf in macos for ios! thanks you!
related: https://stackoverflow.com/questions/69335349/error-when-compiling-protobuf-for-c-in-ios-undefined-symbols-and-ld-warni?noredirect=1#comment122548676_69335349

@bitcoin bitcoin locked and limited conversation to collaborators Sep 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants