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

lftp does not build macOS 15 #1200

Open
sth0 opened this issue Dec 23, 2024 · 4 comments
Open

lftp does not build macOS 15 #1200

sth0 opened this issue Dec 23, 2024 · 4 comments
Assignees

Comments

@sth0
Copy link
Contributor

sth0 commented Dec 23, 2024

I get undefined symbols during linking. A lot of them. Tried updating to newer upstream 4.9.3 but get the same error.

Undefined symbols for architecture x86_64:
  "shell_encode(char const*, int)", referenced from:
      LocalAccess::Do() in LocalAccess.o
      LocalAccess::Do() in LocalAccess.o
  "xfree(void*)", referenced from:
      LocalAccess::LocalAccess() in LocalAccess.o

I think the error is further up when the library is built where each of the object files has no symbols?

/bin/sh ../libtool --silent  --tag=CC   --mode=link gcc  -Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic -Wno-tautological-constant-out-of-range-compare -Wno-sign-conversion -Wno-type-limits -Wno-unused-const-variable -g -O2 -Wall  -no-undefined     -lpthread    -lcrypto  -L/opt/sw/lib -liconv -R/opt/sw/lib -L/opt/sw/lib -lintl -R/opt/sw/lib -Wl,-framework -Wl,CoreFoundation      -L/opt/sw/lib/x86_64-darwin -L/opt/sw/lib -Wl,-headerpad_max_install_names -o libgnu.la  libgnu_la-argmatch.lo libgnu_la-arpa_inet.lo libgnu_la-openat-proc.lo libgnu_la-basename-lgpl.lo libgnu_la-btoc32.lo  libgnu_la-byteswap.lo libgnu_la-c-ctype.lo libgnu_la-c-strcasecmp.lo libgnu_la-c-strncasecmp.lo libgnu_la-c32_apply_type_test.lo libgnu_la-c32_get_type_test.lo libgnu_la-c32isalnum.lo libgnu_la-c32isalpha.lo libgnu_la-c32isblank.lo libgnu_la-c32iscntrl.lo libgnu_la-c32isdigit.lo libgnu_la-c32isgraph.lo libgnu_la-c32islower.lo libgnu_la-c32isprint.lo libgnu_la-c32ispunct.lo libgnu_la-c32isspace.lo libgnu_la-c32isupper.lo libgnu_la-c32isxdigit.lo libgnu_la-c32tolower.lo libgnu_la-c32width.lo libgnu_la-chdir-long.lo libgnu_la-chown.lo  libgnu_la-cloexec.lo   libgnu_la-af_alg.lo libgnu_la-md5-stream.lo libgnu_la-md5.lo libgnu_la-sha1-stream.lo libgnu_la-sha1.lo   libgnu_la-error.lo libgnu_la-exitfail.lo   libgnu_la-fd-hook.lo libgnu_la-fflush.lo libgnu_la-filemode.lo libgnu_la-filenamecat-lgpl.lo libgnu_la-float.lo  libgnu_la-fpurge.lo libgnu_la-freading.lo libgnu_la-free.lo libgnu_la-fseek.lo libgnu_la-fseeko.lo libgnu_la-fstat.lo libgnu_la-fstatat.lo     libgnu_la-getlogin_r.lo libgnu_la-getopt.lo libgnu_la-getopt1.lo  libgnu_la-gettime.lo  malloc/libgnu_la-dynarray_at_failure.lo malloc/libgnu_la-dynarray_emplace_enlarge.lo malloc/libgnu_la-dynarray_finalize.lo malloc/libgnu_la-dynarray_resize.lo malloc/libgnu_la-dynarray_resize_clear.lo malloc/libgnu_la-scratch_buffer_grow.lo malloc/libgnu_la-scratch_buffer_grow_preserve.lo malloc/libgnu_la-scratch_buffer_set_array_size.lo libgnu_la-glob.lo libgnu_la-globfree.lo libgnu_la-glob_pattern_p.lo libgnu_la-hard-locale.lo libgnu_la-human.lo libgnu_la-ialloc.lo          libgnu_la-lchown.lo libgnu_la-localcharset.lo   glthread/libgnu_la-lock.lo  libgnu_la-lstat.lo libgnu_la-malloca.lo libgnu_la-math.lo libgnu_la-mbrtoc32.lo   libgnu_la-mbsrtoc32s.lo  libgnu_la-mbswidth.lo libgnu_la-mbszero.lo  libgnu_la-memcasecmp.lo  libgnu_la-mempcpy.lo libgnu_la-memrchr.lo libgnu_la-modechange.lo   libgnu_la-nl_langinfo.lo  libgnu_la-nstrftime.lo glthread/libgnu_la-once.lo libgnu_la-open.lo libgnu_la-openat.lo libgnu_la-openat-die.lo  libgnu_la-parse-datetime.lo libgnu_la-passfd.lo libgnu_la-poll.lo libgnu_la-printf-frexp.lo libgnu_la-printf-frexpl.lo  libgnu_la-quotearg.lo  libgnu_la-readlink.lo  libgnu_la-reallocarray.lo libgnu_la-regex.lo libgnu_la-save-cwd.lo   libgnu_la-setlocale_null.lo libgnu_la-setlocale-lock.lo libgnu_la-setlocale_null-unlocked.lo  libgnu_la-sockets.lo libgnu_la-stat.lo libgnu_la-stat-time.lo   libgnu_la-stdlib.lo    libgnu_la-strerror.lo libgnu_la-strerror-override.lo  libgnu_la-strnlen1.lo   libgnu_la-strtoull.lo  libgnu_la-sys_socket.lo glthread/libgnu_la-threadlib.lo  libgnu_la-time_rz.lo libgnu_la-timegm.lo libgnu_la-timespec.lo  unicase/libgnu_la-tolower.lo unictype/libgnu_la-ctype_alnum.lo unictype/libgnu_la-ctype_alpha.lo unictype/libgnu_la-ctype_blank.lo unictype/libgnu_la-ctype_cntrl.lo unictype/libgnu_la-ctype_digit.lo unictype/libgnu_la-ctype_graph.lo unictype/libgnu_la-ctype_lower.lo unictype/libgnu_la-ctype_print.lo unictype/libgnu_la-ctype_punct.lo unictype/libgnu_la-ctype_space.lo unictype/libgnu_la-ctype_upper.lo unictype/libgnu_la-ctype_xdigit.lo libgnu_la-unistd.lo unistr/libgnu_la-u32-chr.lo unistr/libgnu_la-u32-cpy.lo unistr/libgnu_la-u32-pcpy.lo unistr/libgnu_la-u32-strcat.lo unistr/libgnu_la-u32-strlen.lo unistr/libgnu_la-u8-mbtoucr.lo unistr/libgnu_la-u8-uctomb.lo unistr/libgnu_la-u8-uctomb-aux.lo uniwidth/libgnu_la-width.lo  libgnu_la-vsnzprintf.lo   libgnu_la-wctype-h.lo libgnu_la-wcwidth.lo      libgnu_la-wmempcpy.lo libgnu_la-xmalloc.lo libgnu_la-xalloc-die.lo libgnu_la-xsize.lo libgnu_la-xstrtol.lo libgnu_la-xstrtoul.lo libgnu_la-xstrtoumax.lo asnprintf.lo fnmatch.lo mbsrtoc32s-state.lo memmem.lo mktime.lo printf-args.lo printf-parse.lo strstr.lo vasnprintf.lo vsnprintf.lo wcwidth.lo  -lcurses -lresolv  -lidn2
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-arpa_inet.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-af_alg.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-fd-hook.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-float.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-math.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-stdlib.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-sys_socket.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-threadlib.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-unistd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-u8-uctomb.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-wctype-h.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-arpa_inet.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-af_alg.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-fd-hook.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-float.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-math.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-stdlib.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-sys_socket.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-threadlib.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-unistd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-u8-uctomb.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libgnu.a(libgnu_la-wctype-h.o) has no symbols
@dmacks
Copy link
Member

dmacks commented Dec 24, 2024

It's something related to libtool and enforcing symbol resolution (hardening the build). Those symbols actually do exist in other .o that should be linked in, or else the compiler should not be caring that they're not. Either libtool is being overly strict because it doesn't know that newer OS X do not require such strictness, or it's being appropriately strict and upstream doesn't know that it needs to make some adjustments.

Try adding the following to PatchScript, which will reveal how libtool is calling the linker:

perl -pi -e 's/LIBTOOL --silent/LIBTOOL/' configure

then look at the lines where proto-file.la is created. For me on 10.13, that is:

/bin/sh ../libtool  --tag=CXX   --mode=link g++ -std=gnu++11  -O2 -Wall -Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -fno-implement-inlines -module -avoid-version -rpath /sw/lib/lftp/4.9.2 -L/sw/lib -Wl,-headerpad_max_install_names -o proto-file.la -rpath /sw/lib/lftp/4.9.2 LocalAccess.lo  -lcurses -lresolv  -lidn2
libtool: link: g++ -std=gnu++11 -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/liblftp-network.dylib  .libs/liblftp_network_la-NetAccess.o .libs/liblftp_network_la-Resolver.o .libs/liblftp_network_la-lftp_ssl.o .libs/liblftp_network_la-buffer_ssl.o .libs/liblftp_network_la-RateLimit.o .libs/liblftp_network_la-network.o .libs/liblftp_network_la-buffer_zlib.o   -Wl,-force_load,../lib/.libs/libgnu.a  -L/sw/lib -lssl -lcrypto /sw/lib/libiconv.dylib /sw/lib/libintl.dylib -L/usr/lib -lz -lcurses -lresolv /sw/lib/libidn2.dylib  -O2 -Wl,-headerpad_max_install_names   -install_name  /sw/lib/lftp/4.9.2/liblftp-network.dylib  -Wl,-single_module

and there is no error. I bet for you the -Wl,-undefined -Wl,dynamic_lookup is missing from that second line.

@dmacks
Copy link
Member

dmacks commented Dec 25, 2024

4.9.3 exploded worse for me, with a ton of duplicate-symbol errors and also a missing -std=c++17 flag (which would mean the this version of package needs to be dist-restricted). But either way, there is a compile-time flaw due to an ancient libtool.

@sth0
Copy link
Contributor Author

sth0 commented Dec 27, 2024

The line
/bin/sh ../libtool --tag=CXX --mode=link g++ -O2 -Wall -Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -fno-implement-inlines -module -avoid-version -rpath /opt/sw/lib/lftp/4.9.3 -L/opt/sw/lib/x86_64-darwin -L/opt/sw/lib -Wl,-headerpad_max_install_names -o proto-file.la -rpath /opt/sw/lib/lftp/4.9.3 LocalAccess.lo -lcurses -lresolv -lidn2
Does not have -Wl,-undefined -Wl,dynamic_lookup but lists a bunch of overrides that are not declared overrides in the output. Don't understand libtool enough to figure out where I would tell it to include those options?

@sth0
Copy link
Contributor Author

sth0 commented Dec 30, 2024

There are some duplicate symbol errors and a lot of extras. But this seems to be the first missing symbol definitions. I am building with maxbuildjobs=1 to avoid threading weirdness in the output.

mv -f .deps/TorrentTracker.Tpo .deps/TorrentTracker.Plo
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -O2 -Wall -Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -fno-implement-inlines -module -avoid-version -rpath /opt/sw/lib/lftp/4.9.3 -L/opt/s
w/lib/x86_64-darwin -L/opt/sw/lib -Wl,-headerpad_max_install_names -o cmd-mirror.la -rpath /opt/sw/lib/lftp/4.9.3 MirrorJob.lo  -lcurses -lresolv  -lidn2
libtool: link: g++ -r -keep_private_externs -nostdlib -o .libs/liblftp-network.dylib-master.o  .libs/liblftp_network_la-NetAccess.o .libs/liblftp_network_la-Resolver.o .libs/liblftp_network_la-lftp_ssl.o .l
ibs/liblftp_network_la-buffer_ssl.o .libs/liblftp_network_la-RateLimit.o .libs/liblftp_network_la-network.o .libs/liblftp_network_la-buffer_zlib.o   -Wl,-force_load,../lib/.libs/libgnu.a
mv -f .deps/Bencode.Tpo .deps/Bencode.Plo
clang++: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]
2 warnings generated.
Undefined symbols for architecture x86_64:
  "shell_encode(char const*, int)", referenced from:
      LocalAccess::Do() in LocalAccess.o
      LocalAccess::Do() in LocalAccess.o
  "xfree(void*)", referenced from:
      LocalAccess::LocalAccess() in LocalAccess.o
  "xgetcwd()", referenced from:
      LocalAccess::LocalAccess() in LocalAccess.o
  "xstrset(char*&, char const*)", referenced from:
      LocalAccess::Init() in LocalAccess.o
      LocalAccess::Init() in LocalAccess.o
  "dir_file(char const*, char const*)", referenced from:
      LocalAccess::Do() in LocalAccess.o

Attaching the full output for the curious. I really can't see where this error originates.
fink-lftp.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants