Build fails on macOS
Hi, I'm a maintainer for the Homebrew package manager. I've been trying to get our packaged version of msitools
updated from 0.99
to 0.100
, and I've been having some issues:
- In the file
libmsi/string.c
, the fileendian.h
is included, but this header lives atmachine/endian.h
on macOS. I managed to get around this by adding ifdefs around the include statement to change the location on macOS, but there are still other compilation issues - After resolving the aforementioned include issue, compilation fails with the following error:
libtool: link: clang -dynamiclib -o .libs/libmsi.0.dylib .libs/alter.o .libs/create.o .libs/debug.o .libs/delete.o .libs/distinct.o .libs/drop.o .libs/insert.o .libs/libmsi-database.o .libs/libmsi-enums.o .libs/libmsi-istream.o .libs/libmsi-query.o .libs/libmsi-record.o .libs/libmsi-summary-info.o .libs/select.o .libs/sql-parser.o .libs/storages.o .libs/streams.o .libs/string.o .libs/table.o .libs/tokenize.o .libs/update.o .libs/where.o -L/usr/local/Cellar/glib/2.62.4/lib -L/usr/local/opt/gettext/lib -L/usr/local/Cellar/libgsf/1.14.46_1/lib -lgsf-1 -lxml2 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -g -O2 -install_name /usr/local/Cellar/msitools/0.100/lib/libmsi.0.dylib -compatibility_version 1 -current_version 1.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libmsi-symbols.expsym
Undefined symbols for architecture x86_64:
"_le16toh", referenced from:
_msi_load_string_table in string.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libmsi.la] Error 1
make[2]: *** [install] Error 2
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2
I found that le16toh
is supposed to be in endian.h
, but evidently Linux's endian.h
and macOS's machine/endian.h
are not interchangeable.
Edited by Caleb Xu