Bug 276542 - Building heimdal from source fails on llvm16 and llvm17
Summary: Building heimdal from source fails on llvm16 and llvm17
Status: Closed DUPLICATE of bug 275979
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 276104
  Show dependency treegraph
 
Reported: 2024-01-22 22:28 UTC by Minsoo Choo
Modified: 2024-03-20 22:20 UTC (History)
6 users (show)

See Also:


Attachments
Patch adjusting LDFLAGS to build on newer clang versions (507 bytes, patch)
2024-02-05 15:27 UTC, Martin Neubauer
m.ne: maintainer-approval?
Details | Diff
security/heimdal: fix build with lld 17 (1.12 KB, patch)
2024-03-09 20:53 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Minsoo Choo 2024-01-22 22:28:17 UTC
Building heimdal for source fails on llvm16 and llvm17.

I used the latest version, which is 7.8.0. <https://github.com/heimdal/heimdal/releases/tag/heimdal-7.8.0>

This program occurs since llvm16, and llvm15 does not have this problem. This also occurs only on FreeBSD, since building with llvm17 on macOS works.

autoconf, autoconf-archive, automake, libtool, cpan:JSON, gmake, and llvm are required for build.

To use specific version of clang, specify $CC with export CC=(clang17, clang16, clang15, gcc, ...)

$ curl -L https://github.com/heimdal/heimdal/releases/download/heimdal-7.8.0/heimdal-7.8.0.tar.gz > heimdal.tar.gz
$ tar -xzf heimdal.tar.gz
$ cd heimdal-7.8.0/
$ ./autogen.sh 
$ ./configure MAKE=gmake 
$ gmake -j12
(...)
  CC       emalloc.lo
  CC       erealloc.lo
  CC       estrdup.lo
  CC       strlwr.lo
  CC       strsep_copy.lo
  CC       strupr.lo
  CCLD     libroken.la
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetcap' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetclose' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetmatch' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetnum' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetset' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetustr' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'err' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'errx' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'hex_decode' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'hex_encode' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_asprintf' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_cgetent' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_cgetstr' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_closefrom' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_flock' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_fnmatch' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_freeaddrinfo' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_freehostent' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_freeifaddrs' failed: symbol not defined
ld: error: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_gai_strerror' failed: symbol not defined
ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [Makefile:1195: libroken.la] Error 1
gmake[3]: Leaving directory '/home/minsoochoo/heimdal-7.8.0/lib/roken'
gmake[2]: *** [Makefile:1095: all] Error 2
gmake[2]: Leaving directory '/home/minsoochoo/heimdal-7.8.0/lib/roken'
gmake[1]: *** [Makefile:576: all-recursive] Error 1
gmake[1]: Leaving directory '/home/minsoochoo/heimdal-7.8.0/lib'
gmake: *** [Makefile:625: all-recursive] Error 1
Comment 1 Mina Galić freebsd_triage 2024-01-23 00:35:42 UTC
can you reproduce this with our port?
Comment 2 Minsoo Choo 2024-01-25 22:36:06 UTC
The build log is around 2300KB, so I cannot upload it on bugzilla. I can send it through email if needed.

.libs/libroken_la-snprintf.o .libs/libroken_la-socket.o .libs/libroken_la-strcollect.o .libs/libroken_la-strerror_r.o .libs/libroken_la-strpool.o .libs/libroken_la-timeval.o .libs/libroken_la-tm2time.o .libs/libroken_la-unvis.o .libs/libroken_la-verify.o .libs/libroken_la-vis.o .libs/libroken_la-warnerr.o .libs/libroken_la-write_pid.o .libs/libroken_la-xfree.o .libs/copyhostent.o .libs/ecalloc.o .libs/emalloc.o .libs/erealloc.o .libs/estrdup.o .libs/strlwr.o .libs/strsep_copy.o .libs/strupr.o   -L/usr/local/lib -lcrypt -lpthread  -O2 -fstack-protector-strong -Wl,--version-script -Wl,./version-script.map -Wl,-rpath -Wl,/usr/local/lib/heimdal:/usr/lib -fstack-protector-strong   -Wl,-soname -Wl,libroken.so.18 -o .libs/libroken.so.18.1.0
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetcap' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetclose' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetmatch' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetnum' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetset' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'cgetustr' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'err' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'errx' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'hex_decode' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'hex_encode' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_asprintf' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_cgetent' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_cgetstr' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_closefrom' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_flock' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_fnmatch' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_freeaddrinfo' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_freehostent' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_freeifaddrs' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_gai_strerror' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_getaddrinfo' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_getifaddrs' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_getipnodebyaddr' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_getipnodebyname' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_getnameinfo' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_getprogname' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_glob' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_globfree' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_inet_ntop' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_inet_pton' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_localtime_r' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_memset_s' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_mkstemp' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_readv' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strerror' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strerror_r' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_setprogname' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strftime' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strlcat' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strlcpy' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strndup' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strnlen' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strptime' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strsvis' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strsvisx' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strtoll' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strtoull' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strunvisx' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strvis' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_strvisx' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_svis' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_timegm' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_tdelete' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_tfind' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_tsearch' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_twalk' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_vasprintf' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_vis' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'rk_vsnprintf' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'simple_execl' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'verr' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'verrx' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'vwarn' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'vwarnx' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'warn' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'warnx' failed: symbol not defined
ld: warning: version script assignment of 'HEIMDAL_ROKEN_1.0' to symbol 'writev' failed: symbol not defined
(similar warnings for other .la builds)

FreeBSD 14 with llvm16 builds with warnings, which says symbols are not defined. This becomes an error with llvm17.
Comment 3 Martin Neubauer 2024-02-05 15:27:06 UTC
Created attachment 248205 [details]
Patch  adjusting LDFLAGS to build on newer clang versions

After stumbling onto this issue myself, I found a (temporary?) workaround here:
https://reviews.llvm.org/D135402

Gathering from the comments there, this issue should be addressed properly upstream, but for the time being the submitted patch should be sufficient.
Comment 4 Tatsuki Makino 2024-03-08 03:15:34 UTC
This behavior changes depending on whether configure is able to use --version-script.
Some ports have problems there, but ${WRKSRC}/cf/version-script.m4 of security/heimdal seems to have no problems.
It seems to be fine using clang17.

Almost all of version-script file names in heimdal are version-script.map.
Of these, only ${WRKSRC}/lib/roken/version-script.map seems to have a problem.
The file even contains symbol names that seem to be in the C language specification.
Those unnecessary symbol names will need to be removed.
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2024-03-09 20:53:40 UTC
Created attachment 249056 [details]
security/heimdal: fix build with lld 17
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2024-03-20 22:20:38 UTC
Fixed by https://cgit.freebsd.org/ports/commit/?id=64f7f98bb61947a72001a84f06840c374b26628d for bug 275979.

*** This bug has been marked as a duplicate of bug 275979 ***