Bug 226970

Summary: audio/easytag: fails to build with lld as the system linker
Product: Ports & Packages Reporter: Ed Maste <emaste>
Component: Individual Port(s)Assignee: Roman Bogorodskiy <novel>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (novel)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 214864    

Description Ed Maste freebsd_committer freebsd_triage 2018-03-27 13:02:28 UTC
I'm working on switching to LLVM's lld linker as the FreeBSD system linker (/usr/bin/ld)[1], and the port in this PR is reported as a new failure in the exp-run, PR 214864.

An excerpt from the build log[2]:
---
checking the id3lib version... configure: error: could not determine id3lib version
===>  Script "configure" failed unexpectedly.
---

FreeBSD 11 and later have lld available as /usr/bin/ld.lld, so one simple option for testing is to just symlink /usr/bin/ld to ld.lld (and restore it to ld.bfd).

A port Makefile knob, LLD_UNSAFE=yes, exists to indicate that a port does not work with lld, and requires either /usr/bin/ld.bfd or binutils from ports. This should work for the common case of ports written in C using GNU autoconf; it may have no effect on other ports.

[1] https://lists.freebsd.org/pipermail/freebsd-current/2018-March/068985.html
[2] http://package18.nyi.freebsd.org/data/headamd64PR214864-default/2018-03-21_17h43m11s/logs/errors/easytag-2.4.3_1.log
Comment 1 Ed Maste freebsd_committer freebsd_triage 2018-03-27 21:25:42 UTC
Via tobik@ in ports r465725, BINARY_ALIAS=ld=ld.bfd may be an effective workaround if LLD_UNSAFE does not work.
Comment 2 Roman Bogorodskiy freebsd_committer freebsd_triage 2018-03-28 16:23:16 UTC
Hm, in config.log there is more details on this failure:

configure:18938: cc -o conftest -g -fstack-protector -fno-strict-aliasing -I/usr/local/include -DHAVE_GTK  -fstack-protector conftest.c -lid3 -L/usr/local/lib >&5
configure:18938: $? = 0
configure:18938: ./conftest
/usr/local/lib/libid3-3.8.so.3: Undefined symbol "_ZTVN10__cxxabiv120__si_class_type_infoE"

It looks like it's really pulling in come c++ stuff:

$ nm --demangle -D /usr/local/lib/libid3-3.8.so.3|grep class
                 U vtable for __cxxabiv1::__class_type_info
                 U vtable for __cxxabiv1::__si_class_type_info
$

I can get it to build by explicitly adding -lstdc++ to id3's LIBS.

--- configure.bak       2016-12-05 23:32:24.000000000 +0400                                                                                                                                                        
+++ configure   2018-03-28 20:21:24.641935000 +0400                                                                                                                                                                
@@ -18871,7 +18871,7 @@                                                                                                                                                                                            
   return 0;                                                                                                                                                                                                       
 }                                                                                                                                                                                                                 
 _ACEOF                                                                                                                                                                                                            
-for ac_lib in '' "id3" "id3 -lstdc++" "id3 -lz" "id3 -lz -lstdc++"; do                                                                                                                                            
+for ac_lib in "id3 -lz -lstdc++"; do                                                                                                                                                                              
   if test -z "$ac_lib"; then                                                                                                                                                                                      
     ac_res="none required"                                                                                                                                                                                        
   else 

I'm not sure though where this comes from and why FreeBSD linker does not complain about that?
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-03-31 12:09:47 UTC
A commit references this bug:

Author: novel
Date: Sat Mar 31 12:09:11 UTC 2018
New revision: 466044
URL: https://svnweb.freebsd.org/changeset/ports/466044

Log:
  audio/easytag: fix build with lld

  When detecting libid3, make sure to add -lstdc++ to its LIBS, otherwise with
  lld easytag's configure script fails to run its test binaries it complies to
  detect libid3 and fails.

  PR:		226970
  Reported by:	emaste

Changes:
  head/audio/easytag/files/patch-configure
Comment 4 Roman Bogorodskiy freebsd_committer freebsd_triage 2018-03-31 12:12:47 UTC
Should be fine now, thanks for report.