Bug 276288

Summary: sysutils/flashrom: LLVM17 issues: compiler/linker error. Port doesn't compile on CURRENT and 14-STABLE (FAILED: libflashrom.so.1.0.0 )
Product: Ports & Packages Reporter: O. Hartmann <ohartmann>
Component: Individual Port(s)Assignee: Michael Zhilin <mizhka>
Status: Closed FIXED    
Severity: Affects Many People Flags: bugzilla: maintainer-feedback? (mizhka)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description O. Hartmann 2024-01-13 07:02:06 UTC
Host: CURRENT (FreeBSD 15.0-CURRENT #3 main-n267554-c8328f1a7b6e: Sat Jan 13 06:31:40 CET 2024  amd64), recently updated LLVM ports suite (as of today).

Port building is done the tradiiotnal way (make/Makefile).

On CURRENT, neither a fresh install, nor the update/upgrade on existing installations are working since the latest update of the port:

[...]
ld: error: version script assignment of 'LIBFLASHROM_1.0' to symbol 'flashrom_board_info' failed: symbol not defined
ld: error: version script assignment of 'LIBFLASHROM_1.0' to symbol 'flashrom_chipset_info' failed: symbol not defined
ld: error: version script assignment of 'LIBFLASHROM_1.0' to symbol 'flashrom_flashchip_info' failed: symbol not defined
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 O. Hartmann 2024-02-10 10:45:08 UTC
Host 14-STABLE (jail, 14.0-STABLE 1400507  amd64), also fails building this port.

Additional infos:

[...]
[ 43% 89/199] cc -Ilibflashrom.so.1.0.0.p -I. -I.. -I../include -I/usr/local/include -I/usr/local/include/libftdi1 -fdiagnostics-color=never -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c99 -O3 -Wshadow -Wmissing-prototypes -Wwrite-strings -Wno-unused-parameter -Wno-address-of-packed-member -Wno-enum-conversion -Wno-missing-braces -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D__BSD_VISIBLE -D__XSI_VISIBLE -D_NETBSD_SOURCE -D_DARWIN_C_SOURCE '-DFLASHROM_VERSION="v1.3.0"' -DHAVE_CLOCK_GETTIME=1 -DHAVE_STRNLEN=1 -DHAVE_UTSNAME=1 -DIS_WINDOWS=0 -D__FLASHROM_LITTLE_ENDIAN__=1 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -DCONFIG_ATAVIA=1 -DCONFIG_BUSPIRATE_SPI=1 -DCONFIG_CH341A_SPI=1 -DCONFIG_DEDIPROG=1 -DCONFIG_DEVELOPERBOX_SPI=1 -DCONFIG_DIGILENT_SPI=1 -DCONFIG_DIRTYJTAG_SPI=1 -DCONFIG_DRKAISER=1 -DCONFIG_DUMMY=1 -DCONFIG_FT2232_SPI=1 -DCONFIG_GFXNVIDIA=1 -DCONFIG_INTERNAL=1 -DCONFIG_INTERNAL_DMI=1 -DCONFIG_IT8212=1 -DCONFIG_NIC3COM=1 -DCONFIG_NICINTEL=1 -DCONFIG_NICINTEL_EEPROM=1 -DCONFIG_NICINTEL_SPI=1 -DCONFIG_NICREALTEK=1 -DCONFIG_OGP_SPI=1 -DCONFIG_PICKIT2_SPI=1 -DCONFIG_PONY_SPI=1 -DCONFIG_RAIDEN_DEBUG_SPI=1 -DCONFIG_RAYER_SPI=1 -DCONFIG_SATAMV=1 -DCONFIG_SATASII=1 -DCONFIG_SERPROG=1 -DCONFIG_STLINKV3_SPI=1 -DCONFIG_USBBLASTER_SPI=1 -DCONFIG_DEFAULT_PROGRAMMER_NAME=NULL '-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""' -MD -MQ libflashrom.so.1.0.0.p/serprog.c.o -MF libflashrom.so.1.0.0.p/serprog.c.o.d -o libflashrom.so.1.0.0.p/serprog.c.o -c ../serprog.c
[ 43% 90/199] cc  -o libflashrom.so.1.0.0 libflashrom.so.1.0.0.p/82802ab.c.o libflashrom.so.1.0.0.p/at45db.c.o libflashrom.so.1.0.0.p/bitbang_spi.c.o libflashrom.so.1.0.0.p/edi.c.o libflashrom.so.1.0.0.p/en29lv640b.c.o libflashrom.so.1.0.0.p/flashchips.c.o libflashrom.so.1.0.0.p/flashrom.c.o libflashrom.so.1.0.0.p/fmap.c.o libflashrom.so.1.0.0.p/helpers.c.o libflashrom.so.1.0.0.p/helpers_fileio.c.o libflashrom.so.1.0.0.p/ich_descriptors.c.o libflashrom.so.1.0.0.p/jedec.c.o libflashrom.so.1.0.0.p/layout.c.o libflashrom.so.1.0.0.p/libflashrom.c.o libflashrom.so.1.0.0.p/opaque.c.o libflashrom.so.1.0.0.p/parallel.c.o libflashrom.so.1.0.0.p/print.c.o libflashrom.so.1.0.0.p/programmer.c.o libflashrom.so.1.0.0.p/programmer_table.c.o libflashrom.so.1.0.0.p/s25f.c.o libflashrom.so.1.0.0.p/sfdp.c.o libflashrom.so.1.0.0.p/spi25.c.o libflashrom.so.1.0.0.p/spi25_statusreg.c.o libflashrom.so.1.0.0.p/spi95.c.o libflashrom.so.1.0.0.p/spi.c.o libflashrom.so.1.0.0.p/sst28sf040.c.o libflashrom.so.1.0.0.p/sst49lfxxxc.c.o libflashrom.so.1.0.0.p/sst_fwhub.c.o libflashrom.so.1.0.0.p/stm50.c.o libflashrom.so.1.0.0.p/udelay.c.o libflashrom.so.1.0.0.p/w29ee011.c.o libflashrom.so.1.0.0.p/w39.c.o libflashrom.so.1.0.0.p/writeprotect.c.o libflashrom.so.1.0.0.p/writeprotect_ranges.c.o libflashrom.so.1.0.0.p/platform_endian_little.c.o libflashrom.so.1.0.0.p/platform_memaccess.c.o libflashrom.so.1.0.0.p/hwaccess_physmap.c.o libflashrom.so.1.0.0.p/hwaccess_x86_msr.c.o libflashrom.so.1.0.0.p/hwaccess_x86_io.c.o libflashrom.so.1.0.0.p/atavia.c.o libflashrom.so.1.0.0.p/pcidev.c.o libflashrom.so.1.0.0.p/buspirate_spi.c.o libflashrom.so.1.0.0.p/serial.c.o libflashrom.so.1.0.0.p/custom_baud.c.o libflashrom.so.1.0.0.p/ch341a_spi.c.o libflashrom.so.1.0.0.p/dediprog.c.o libflashrom.so.1.0.0.p/usbdev.c.o libflashrom.so.1.0.0.p/developerbox_spi.c.o libflashrom.so.1.0.0.p/digilent_spi.c.o libflashrom.so.1.0.0.p/dirtyjtag_spi.c.o libflashrom.so.1.0.0.p/drkaiser.c.o libflashrom.so.1.0.0.p/dummyflasher.c.o libflashrom.so.1.0.0.p/ft2232_spi.c.o libflashrom.so.1.0.0.p/gfxnvidia.c.o libflashrom.so.1.0.0.p/processor_enable.c.o libflashrom.so.1.0.0.p/chipset_enable.c.o libflashrom.so.1.0.0.p/board_enable.c.o libflashrom.so.1.0.0.p/cbtable.c.o libflashrom.so.1.0.0.p/internal.c.o libflashrom.so.1.0.0.p/it87spi.c.o libflashrom.so.1.0.0.p/sb600spi.c.o libflashrom.so.1.0.0.p/amd_imc.c.o libflashrom.so.1.0.0.p/wbsio_spi.c.o libflashrom.so.1.0.0.p/mcp6x_spi.c.o libflashrom.so.1.0.0.p/ichspi.c.o libflashrom.so.1.0.0.p/dmi.c.o libflashrom.so.1.0.0.p/known_boards.c.o libflashrom.so.1.0.0.p/it8212.c.o libflashrom.so.1.0.0.p/nic3com.c.o libflashrom.so.1.0.0.p/nicintel.c.o libflashrom.so.1.0.0.p/nicintel_eeprom.c.o libflashrom.so.1.0.0.p/nicintel_spi.c.o libflashrom.so.1.0.0.p/nicrealtek.c.o libflashrom.so.1.0.0.p/ogp_spi.c.o libflashrom.so.1.0.0.p/pickit2_spi.c.o libflashrom.so.1.0.0.p/pony_spi.c.o libflashrom.so.1.0.0.p/raiden_debug_spi.c.o libflashrom.so.1.0.0.p/usb_device.c.o libflashrom.so.1.0.0.p/rayer_spi.c.o libflashrom.so.1.0.0.p/satamv.c.o libflashrom.so.1.0.0.p/satasii.c.o libflashrom.so.1.0.0.p/serprog.c.o libflashrom.so.1.0.0.p/stlinkv3_spi.c.o libflashrom.so.1.0.0.p/usbblaster_spi.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libflashrom.so.1 -fstack-protector-strong -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wl,-rpath,/usr/local/lib -Wl,-rpath-link,/usr/local/lib -Wl,--version-script,/usr/ports/sysutils/flashrom/work/flashrom-v1.3.0/libflashrom.map /usr/local/lib/libpci.so /usr/lib/libusb.so /usr/local/lib/libftdi1.so -Wl,--end-group
FAILED: libflashrom.so.1.0.0
Comment 2 Michael Zhilin freebsd_committer freebsd_triage 2024-02-10 10:53:50 UTC
Hi, 

Sorry for delay, I'm going to commit patch this weekend and push it to upstream. 
Patch is simple, but I'm waiting for poudriere results.

Thanks!
Comment 3 O. Hartmann 2024-02-10 11:46:05 UTC
When manually set compiler and linker to LLVM16 (setting CC= and LD= ), everything compiles all right. 
So this issue is present everywhere on FreeBSD with LLVM17 as default.

The problem is way beyond my experience and recent compiler skills necessary to solve the problem ad hoc,
Comment 4 O. Hartmann 2024-02-10 12:00:43 UTC
(In reply to Michael Zhilin from comment #2)

... ups, mid air collision ... Thank you very much.
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-02-12 12:53:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5d01dea4a100a08ff5f7aac3855f19fd74e29060

commit 5d01dea4a100a08ff5f7aac3855f19fd74e29060
Author:     Michael Zhilin <mizhka@FreeBSD.org>
AuthorDate: 2024-02-11 17:18:34 +0000
Commit:     Michael Zhilin <mizhka@FreeBSD.org>
CommitDate: 2024-02-12 12:52:02 +0000

    sysutils/flashrom: fix linker error by LLVM17

    PR:             276288
    Reported by:    ohartmann@walstatt.org (O. Hartmann), pkg-fallout
    MFH:            2024Q1
    Sponsored by:   Postgres Professional

 sysutils/flashrom/Makefile                          |  2 +-
 sysutils/flashrom/files/patch-libflashrom.map (new) | 18 ++++++++++++++++++
 sysutils/flashrom/files/patch-meson.build (new)     | 11 +++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)
Comment 6 Michael Zhilin freebsd_committer freebsd_triage 2024-02-14 15:53:36 UTC
Committed. Thank you for report!