tfcollins / homebrew-formulae

Some useful homebrew taps
4 stars 3 forks source link

Building on M1 with for GR 3.10 #18

Open Timvrakas opened 2 years ago

Timvrakas commented 2 years ago

I've installed libiio and libad9361-iio using these formulae. Then I try building gnuradio 3.10.2.0 using the brew core formula, (with the "ENABLE_GR_IIO" flag added)

It dosen't seem to like libiio for some reason:

ld: can't map file, errno=22 file '/Library/Frameworks/iio.framework' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [gr-iio/lib/libgnuradio-iio.3.10.2.0.dylib] Error 1
make[1]: *** [gr-iio/lib/CMakeFiles/gnuradio-iio.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Any ideas?

EDIT: Narrowed it down:

timv@shafer lib % /opt/homebrew/Library/Homebrew/shims/mac/super/clang++  -fvisibility=hidden -Wsign-compare -Wall -Wno-uninitialized -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -dynamiclib -Wl,-headerpad_max_install_names -Xlinker -undefined -Xlinker dynamic_lookup -compatibility_version 3.10.2 -current_version 3.10.2 -o libgnuradio-iio.3.10.2.0.dylib -install_name /opt/homebrew/Cellar/gnuradio/3.10.2.0/lib/libgnuradio-iio.3.10.2.dylib "CMakeFiles/gnuradio-iio.dir/attr_sink_impl.cc.o" "CMakeFiles/gnuradio-iio.dir/attr_source_impl.cc.o" "CMakeFiles/gnuradio-iio.dir/attr_updater_impl.cc.o" "CMakeFiles/gnuradio-iio.dir/dds_control_impl.cc.o" "CMakeFiles/gnuradio-iio.dir/device_sink_impl.cc.o" "CMakeFiles/gnuradio-iio.dir/device_source_impl.cc.o" "CMakeFiles/gnuradio-iio.dir/iio_types.cc.o"  -Wl,-rpath,/opt/homebrew/Cellar/gnuradio/3.10.2.0/lib /Library/Frameworks/iio.framework ../../gr-blocks/lib/libgnuradio-blocks.3.10.2.0.dylib ../../gnuradio-runtime/lib/libgnuradio-runtime.3.10.2.0.dylib ../../gnuradio-runtime/lib/pmt/libgnuradio-pmt.3.10.2.0.dylib /opt/homebrew/lib/libboost_program_options-mt.dylib /opt/homebrew/lib/libboost_system-mt.dylib /opt/homebrew/lib/libboost_regex-mt.dylib /opt/homebrew/lib/libboost_thread-mt.dylib /opt/homebrew/lib/libspdlog.1.10.0.dylib /opt/homebrew/lib/libfmt.8.1.1.dylib /opt/homebrew/lib/libgmpxx.dylib /opt/homebrew/lib/libgmp.dylib /opt/homebrew/lib/libvolk.2.5.1.dylib -lm /opt/homebrew/lib/libsndfile.dylib -v
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -dynamic -dylib -dylib_compatibility_version 3.10.2 -dylib_current_version 3.10.2 -arch arm64 -dylib_install_name /opt/homebrew/Cellar/gnuradio/3.10.2.0/lib/libgnuradio-iio.3.10.2.dylib -platform_version macos 12.0.0 12.3 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -w -o libgnuradio-iio.3.10.2.0.dylib -L/opt/homebrew/opt/libffi/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/opt/icu4c/lib -L/opt/homebrew/opt/berkeley-db/lib -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/opt/qt@5/lib -L/opt/homebrew/opt/qwt-qt5/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -headerpad_max_install_names -undefined dynamic_lookup CMakeFiles/gnuradio-iio.dir/attr_sink_impl.cc.o CMakeFiles/gnuradio-iio.dir/attr_source_impl.cc.o CMakeFiles/gnuradio-iio.dir/attr_updater_impl.cc.o CMakeFiles/gnuradio-iio.dir/dds_control_impl.cc.o CMakeFiles/gnuradio-iio.dir/device_sink_impl.cc.o CMakeFiles/gnuradio-iio.dir/device_source_impl.cc.o CMakeFiles/gnuradio-iio.dir/iio_types.cc.o -rpath /opt/homebrew/Cellar/gnuradio/3.10.2.0/lib /Library/Frameworks/iio.framework ../../gr-blocks/lib/libgnuradio-blocks.3.10.2.0.dylib ../../gnuradio-runtime/lib/libgnuradio-runtime.3.10.2.0.dylib ../../gnuradio-runtime/lib/pmt/libgnuradio-pmt.3.10.2.0.dylib /opt/homebrew/lib/libboost_program_options-mt.dylib /opt/homebrew/lib/libboost_system-mt.dylib /opt/homebrew/lib/libboost_regex-mt.dylib /opt/homebrew/lib/libboost_thread-mt.dylib /opt/homebrew/lib/libspdlog.1.10.0.dylib /opt/homebrew/lib/libfmt.8.1.1.dylib /opt/homebrew/lib/libgmpxx.dylib /opt/homebrew/lib/libgmp.dylib /opt/homebrew/lib/libvolk.2.5.1.dylib -lm /opt/homebrew/lib/libsndfile.dylib -headerpad_max_install_names -lc++ -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.osx.a
ld: can't map file, errno=22 file '/Library/Frameworks/iio.framework' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Timvrakas commented 2 years ago

OK, I was able to fix the build by removing /Library/Frameworks/iio.framework from my CMake link.txt files using brew install --debug. How can I set the formula up to do this properly?

It's these two files in particular: build/gr-iio/lib/CMakeFiles/gnuradio-iio.dir/link.txt build/gr-iio/python/iio/bindings/CMakeFiles/iio_python.dir/link.txt

For now I've added:

system "sed -i '' 's|/opt/homebrew/opt/libiio/Frameworks/iio.framework||g' gr-iio/lib/CMakeFiles/gnuradio-iio.dir/link.txt"
system "sed -i '' 's|/opt/homebrew/lib/ad9361.framework||g' gr-iio/lib/CMakeFiles/gnuradio-iio.dir/link.txt"
system "sed -i '' 's|/opt/homebrew/opt/libiio/Frameworks/iio.framework||g' gr-iio/python/iio/bindings/CMakeFiles/iio_python.dir/link.txt"
system "sed -i '' 's|/opt/homebrew/lib/ad9361.framework||g' gr-iio/python/iio/bindings/CMakeFiles/iio_python.dir/link.txt"

to the GNURadio formula