Bug 230627

Summary: archivers/unarchiver: fails to build with Clang 7
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Alexey Dokuchaev <danfe>
Status: Closed FIXED    
Severity: Affects Only Me CC: d5nch3ck
Priority: --- Keywords: needs-patch
Version: LatestFlags: bugzilla: maintainer-feedback? (danfe)
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 214864, 230355    

Description Jan Beich freebsd_committer 2018-08-14 20:08:09 UTC
$ poudriere jail -cj clang7 -a amd64 -v projects/clang700-import -m svn+https
$ poudriere testport -j clang7 archivers/unarchiver
[...]
ld: error: undefined symbol: ._OBJC_REF_CLASS_NSAutoreleasePool
>>> referenced by DetectorTest.m
>>>               Build/DetectorTest.o:(main)

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSData
>>> referenced by DetectorTest.m
>>>               Build/DetectorTest.o:(main)

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSString
>>> referenced by DetectorTest.m
>>>               Build/DetectorTest.o:(main)

ld: error: undefined symbol: __objc_load
>>> referenced by DetectorTest.m
>>>               Build/DetectorTest.o:(.objcv2_load_function)

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSArray
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(_c_UniversalDetector__possibleMIMECharsets) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSObject
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(_i_UniversalDetector__init) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSObject
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(_i_UniversalDetector__dealloc) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(_i_UniversalDetector__MIMECharset) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.1) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.2) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.3) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.4) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.5) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.6) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.7) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.8) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.9) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.10) in archive libUniversalDetector.a

ld: error: undefined symbol: ._OBJC_CLASS_NSConstantString
>>> referenced by UniversalDetector.m
>>>               UniversalDetector.o:(.L.objc_string.11) in archive libUniversalDetector.a

ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
c++: error: linker command failed with exit code 1 (use -v to see invocation)

http://package18.nyi.freebsd.org/data/headamd64PR230355-default/2018-08-11_19h01m06s/logs/errors/unar-1.10.1_9.log
Comment 1 Jan Beich freebsd_committer 2018-08-14 20:13:28 UTC
Adding LLD_UNSAFE doesn't help, see https://ptpb.pw/VkdA

Build/DetectorTest.o: In function `main':
DetectorTest.m:(.text+0x17): undefined reference to `._OBJC_REF_CLASS_NSAutoreleasePool'
DetectorTest.m:(.text+0x63): undefined reference to `._OBJC_REF_CLASS_NSData'
DetectorTest.m:(.text+0x6a): undefined reference to `._OBJC_REF_CLASS_NSString'
Build/DetectorTest.o: In function `.objcv2_load_function':
DetectorTest.m:(.text..objcv2_load_function[.objcv2_load_function]+0x6): undefined reference to `__objc_load'
libUniversalDetector.a(UniversalDetector.o): In function `_c_UniversalDetector__possibleMIMECharsets':
UniversalDetector.m:(.text+0x3e): undefined reference to `._OBJC_REF_CLASS_NSArray'
libUniversalDetector.a(UniversalDetector.o): In function `_i_UniversalDetector__init':
UniversalDetector.m:(.text+0x18f): undefined reference to `._OBJC_REF_CLASS_NSObject'
libUniversalDetector.a(UniversalDetector.o): In function `_i_UniversalDetector__dealloc':
UniversalDetector.m:(.text+0x232): undefined reference to `._OBJC_REF_CLASS_NSObject'
libUniversalDetector.a(UniversalDetector.o): In function `_i_UniversalDetector__MIMECharset':
UniversalDetector.m:(.text+0x37b): undefined reference to `._OBJC_REF_CLASS_NSString'
libUniversalDetector.a(UniversalDetector.o):(__objc_constant_string+0x0): undefined reference to `._OBJC_CLASS_NSConstantString'
libUniversalDetector.a(UniversalDetector.o):(__objc_constant_string+0x20): undefined reference to `._OBJC_CLASS_NSConstantString'
libUniversalDetector.a(UniversalDetector.o):(__objc_constant_string+0x40): undefined reference to `._OBJC_CLASS_NSConstantString'
libUniversalDetector.a(UniversalDetector.o):(__objc_constant_string+0x60): undefined reference to `._OBJC_CLASS_NSConstantString'
libUniversalDetector.a(UniversalDetector.o):(__objc_constant_string+0x80): undefined reference to `._OBJC_CLASS_NSConstantString'
libUniversalDetector.a(UniversalDetector.o):(__objc_constant_string+0xa0): more undefined references to `._OBJC_CLASS_NSConstantString' follow
libUniversalDetector.a(UniversalDetector.o):(.data+0x250): undefined reference to `._OBJC_CLASS_NSObject'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 2 Jan Beich freebsd_committer 2018-08-14 20:18:33 UTC
Built fine with CC=clang60 + devel/llvm60. Not a LLD issue.
Comment 3 d5nch3ck 2019-02-07 12:45:46 UTC
Tested: kern.version=OpenBSD 6.4-current (GENERIC.MP) #658: Fri Feb  1 02:25:34 MST 2019
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

FIX: https://github.com/D5Nch3ck/MyPorts/commit/de7dfaa1f314f97ad3c4e2b7f275079d009dbe1b

Error:
c++ -Wl,--whole-archive -fexceptions -fgnu-runtime  -o DetectorTest Build/DetectorTest.o libUniversalDetector.a -L/usr/local/lib -Wl,--no-whole-archive -lgnustep-base -lobjc2 -lm
ld: error: undefined symbol: ._OBJC_REF_CLASS_NSAutoreleasePool
>>> referenced by DetectorTest.m:6
>>>               Build/DetectorTest.o:(gnustep_base_user_main)

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSData
>>> referenced by DetectorTest.m:12
>>>               Build/DetectorTest.o:(gnustep_base_user_main)

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSString
>>> referenced by DetectorTest.m:12
>>>               Build/DetectorTest.o:(gnustep_base_user_main)

ld: error: undefined symbol: __objc_load
>>> referenced by DetectorTest.m
>>>               Build/DetectorTest.o:(.objcv2_load_function)

ld: error: undefined symbol: ._OBJC_REF_CLASS_NSArray
Comment 4 d5nch3ck 2019-02-09 12:39:37 UTC
Flag remove: -fgnu-runtime
Comment 5 commit-hook freebsd_committer 2019-03-27 11:17:08 UTC
A commit references this bug:

Author: danfe
Date: Wed Mar 27 11:16:31 UTC 2019
New revision: 496942
URL: https://svnweb.freebsd.org/changeset/ports/496942

Log:
  Unbreak the build against Clang 7 and above by removing offending flag
  and macro definition (-fgnu-runtime and -DGNU_RUNTIME=1, respectively).

  PR:	230627

Changes:
  head/archivers/unarchiver/files/patch-UniversalDetector_Makefile.freebsd
  head/archivers/unarchiver/files/patch-XADMaster_Makefile.freebsd
Comment 6 Alexey Dokuchaev freebsd_committer 2019-03-27 11:22:35 UTC
Fixes committed as ports r496942, thanks!