cc-tool
cc-tool copied to clipboard
Cannot build with Boost 1.76 on macOs Catalina
I was following this zigbee2mqtt tutorial https://www.zigbee2mqtt.io/information/flashing_the_cc2531.html
brew info boost boost: stable 1.76.0 (bottled), HEAD Collection of portable C++ source libraries https://www.boost.org/
./configure checking for Boost's header version... 1_76 checking for the toolset name used by Boost for g++... xgcc42 -xgcc checking for boost/program_options.hpp... yes checking for the Boost program_options library... yes checking for boost/system/error_code.hpp... yes checking for the Boost system library... (cached) yes checking for boost/regex.hpp... yes checking for the Boost regex library... no configure: error: cannot find the flags to link with Boost regex
After removing boost and installing [email protected], ./configure worked
I'm having the same issue with Big Sur 11.5.1, but unfortunately I can't downgrade to @1.60 ...
Error: [email protected] has been disabled because it is a versioned formula!
You can edit de brew formula and disable the warning.
brew edit [email protected]
Em 28 de jul de 2021, à(s) 21:56, SRamsdell1 @.***> escreveu:
I'm having the same issue with Big Sur 11.5.1, but unfortunately I can't downgrade to @1.60 ...
Error: @.*** has been disabled because it is a versioned formula!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dashesy/cc-tool/issues/25#issuecomment-888717706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGKVQZTBEXDG3WUKVJN253T2CRNNANCNFSM5AROLU5A.
Thanks! I tried that with great hope, installed 1.60, but am still getting the failure at the same point.
Be sure to
brew link [email protected]
before compiling, or removing 1.76 prior to installing 1.60
Em 29 de jul de 2021, à(s) 16:14, SRamsdell1 @.***> escreveu:
Thanks! I tried that with great hope, installed 1.60, but am still getting the failure at the same point.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dashesy/cc-tool/issues/25#issuecomment-889393374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGKVQYTHDQ3A2GC6XPZ5UDT2GSCJANCNFSM5AROLU5A.
Finally got it to work, thanks for your help!
Unfortunately [email protected] was removed https://github.com/Homebrew/homebrew-core/pull/84434 So this solution does not work any more.
Solution
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/usr/local/include \
LDFLAGS=-I/usr/local/include \
./bootstrap
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/usr/local/include \
CXXFLAGS="-std=c++0x" \
LDFLAGS="-I/usr/local/include -lboost_system" \
LIBUSB_CFLAGS=-I/usr/local/include/libusb-1.0 \
LIBUSB_LIBS="-L/usr/local/lib -lusb-1.0" \
./configure
Found here https://gist.github.com/kidpixo/ef1a26ae953e3939a4eebe1b6fd2f07c
CC=/usr/bin/clang
CXX=/usr/bin/clang++
CPPFLAGS=-I/usr/local/include
LDFLAGS=-I/usr/local/include
./bootstrap
When running the above i get: ./bootstrap autoreconf: export WARNINGS= autoreconf: Entering directory '.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 autoreconf: configure.ac: tracing autoreconf: running: glibtoolize --copy --force glibtoolize: error: One of these is required: glibtoolize: gm4 gnum4 m4 glibtoolize: error: Please install GNU M4, or 'export M4=/path/to/gnu/m4'. autoreconf: error: glibtoolize failed with exit status: 1
m4 is installed: Warning: m4 1.4.19 is already installed and up-to-date.
May be brew install m4
will help
C=/usr/bin/clang
CXX=/usr/bin/clang++
CPPFLAGS=-I/usr/local/include
CXXFLAGS="-std=c++0x"
LDFLAGS="-I/usr/local/include -lboost_system"
LIBUSB_CFLAGS=-I/usr/local/include/libusb-1.0
LIBUSB_LIBS="-L/usr/local/lib -lusb-1.0"
./configure
This did not work for me. Both on MacOS Mojave and Monterey. I got the same boost error as before.
I've tried with Monterey 12.1 (21C52) and still works fine for me. Make sure you have right env variables, for example replace last line with env && ./configure
Unfortunately, this doesn't seem to work anymore on M1 based MacBook Pro. On M1 Homebrew installs stuff to /opt/homebrew
and I just wasn't able to make it find boost even though it's installed. I may be missing something silly as I'm not really experienced with C/C++ compiling. I've tried following:
# This executes without issues
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/opt/homebrew/include \
LDFLAGS=-I/opt/homebrew/include \
./bootstrap
# This fails
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/opt/homebrew/include \
CXXFLAGS="-std=c++0x" \
LDFLAGS="-I/opt/homebrew/include/boost -lboost_system" \
LIBUSB_CFLAGS=-I/opt/homebrew/include/libusb-1.0 \
LIBUSB_LIBS="-L/opt/homebrew/lib -lusb-1.0" \
./configure
Configure in this case fails with configure: error: C compiler cannot create executables
. The config.log
file points out:
configure:4255: /usr/bin/clang -I/opt/homebrew/include -I/opt/homebrew/include/boost -lboost_system conftest.c >&5
ld: library not found for -lboost_system
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've tried /opt/homebrew/include
instead but it fails with same error. However, /opt/homebrew/include/boost
does exist and contains bunch of *.hpp
files so I guess I just don't know how to point the linker to proper place to look for it.
@xaralis I managed to build it by changing LDFLAGS to
LDFLAGS="-L/opt/homebrew/Cellar/boost/1.78.0_1/lib/" \
@xaralis I managed to build it by changing LDFLAGS to
LDFLAGS="-L/opt/homebrew/Cellar/boost/1.78.0_1/lib/" \
That worked for me. Thanks!
the completed command I used
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/opt/homebrew/include \
CXXFLAGS="-std=c++0x" \
LDFLAGS="-L/usr/local/Cellar/boost/1.78.0_1/lib/" \
LIBUSB_CFLAGS=-I/opt/homebrew/include/libusb-1.0 \
LIBUSB_LIBS="-L/opt/homebrew/lib -lusb-1.0" \
./configure
Thanks to @PaoloConte working for me on mac m1 monterey
brew install boost libboost-all-dev libboost-test-dev autoconf automake libusb pkgconfig libtool
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/opt/homebrew/include \
LDFLAGS=-I/opt/homebrew/include \
./bootstrap
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/opt/homebrew/include \
CXXFLAGS="-std=c++0x" \
LDFLAGS="-L/opt/homebrew/Cellar/boost/1.78.0_1/lib/" \
LIBUSB_CFLAGS=-I/opt/homebrew/include/libusb-1.0 \
LIBUSB_LIBS="-L/opt/homebrew/lib -lusb-1.0" \
./configure`
M1 Sonoma 14.3:
brew reinstall [email protected]
And then
CC=/usr/bin/clang \
CXX=/usr/bin/clang++ \
CPPFLAGS=-I/opt/homebrew/include \
CXXFLAGS="-std=c++0x" \
LDFLAGS="-L/opt/homebrew/Cellar/[email protected]/1.76.0_4/lib/" \
LIBUSB_CFLAGS=-I/opt/homebrew/include/libusb-1.0 \
LIBUSB_LIBS="-L/opt/homebrew/lib -lusb-1.0" \
./configure
But when I run make
then this happens:
ld: Undefined symbols:
boost::filesystem::detail::path_algorithms::extension_v3(boost::filesystem::path const&), referenced from:
option_extract_file_info(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, OptionFileInfo&, bool) in read_target.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Or now this:
src/usb/usb_device.h:14:10: fatal error: 'libusb-1.0/libusb.h' file not found
Dunno if I got further of back :D