vg
vg copied to clipboard
Can't change the libdeflate install_name on MacOS "because larger updated load commands do not fit"
Compilaltion on MacOS Sonoma 14.2 fails with the following error:
error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: changing install names or rpaths can't be redone for: lib/libdeflate.dylib (for architecture arm64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names) make: *** [lib/libdeflate.dylib] Error 1
Adding the -headerpad
and -headerpad_max_install_names
to LD_LIB_FLAGS fails to resolve the issue, though it does make it much further through compilation, to eventually fail with the error:
clang: error: unknown argument: '-headerpad'
Omitting the -headerpad
(using only -headerpad_max_install_names) option reverts to original behavior.
I think adding that flag to LD_LIB_FLAGS
doesn't work because those flags also get passed to the compiler in the vg makefile, and in that context you might need a -Wl,
on the front.
Maybe we need to pass those flags specifically to the libdeflate build? https://github.com/vgteam/vg/blob/963d8d9003884c6c25480215497701871dd4da89/Makefile#L646-L659
Once you get libdeflate.dylib to build with those flags, you can probably take them out and complete the vg build.
Managed to resolve this:
https://github.com/vgteam/vg/blob/963d8d9003884c6c25480215497701871dd4da89/Makefile#L658-L659
Drop in change, doesn't need to be reverted to finish building.
$(LIB_DIR)/libhandlegraph.a: $(LIBHANDLEGRAPH_DIR)/src/include/handlegraph/*.hpp $(LIBHANDLEGRAPH_DIR)/src/*.cpp
+. ./source_me.sh && cd $(LIBHANDLEGRAPH_DIR) && rm -Rf build CMakeCache.txt CMakeFiles && mkdir build && cd build && CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=$(CWD) -DCMAKE_INSTALL_LIBDIR=lib .. && $(MAKE) $(FILTER) && $(MAKE) install
I'm not sure those are the right lines? But I have a PR that I think will do what I think you did, on Mac.