Bug 216048 - comms/rtl-sdr: fails to build with clang 4.0
Summary: comms/rtl-sdr: fails to build with clang 4.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ganael LAPLANCHE
URL:
Keywords: needs-patch
Depends on:
Blocks: 216008
  Show dependency treegraph
 
Reported: 2017-01-14 04:26 UTC by Jan Beich (mail not working)
Modified: 2017-01-19 05:37 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (martymac)


Attachments
fix, v0 (1.07 KB, patch)
2017-01-14 18:21 UTC, Jan Beich (mail not working)
no flags Details | Diff
alternative fix, v0 (1.50 KB, patch)
2017-01-14 19:02 UTC, Jan Beich (mail not working)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich (mail not working) freebsd_committer 2017-01-14 04:26:42 UTC
rtl_adsb.o: In function `manchester':
rtl_adsb.c:(.text+0x69e): undefined reference to `preamble'
cc: error: linker command failed with exit code 1 (use -v to see invocation)

--- src/.deps/rtl_adsb.Po	clang39
+++ src/.deps/rtl_adsb.Po	clang40
@@ -22,6 +22,8 @@ rtl_adsb.o: rtl_adsb.c /usr/include/errn
   ../include/rtl-sdr.h ../include/rtl-sdr_export.h \
   convenience/convenience.h
 
+rtl_adsb.c:
+
 /usr/include/errno.h:
 
 /usr/include/sys/cdefs.h:

build log: http://sprunge.us/EDbO
Comment 1 Jan Beich (mail not working) freebsd_committer 2017-01-14 04:32:03 UTC
Probably the same libtool issue as bug 216043.

$ du -h src/rtl_adsb.o
 20K    src/rtl_adsb.o

$ nm src/rtl_adsb.o
nm: src/rtl_adsb.o: File truncated

$ readelf -a src/rtl_adsb.o
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - FreeBSD
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          17376 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           64 (bytes)
  Number of section headers:         17
  Section header string table index: 1
readelf: Error: Reading 0x440 bytes extends past end of file for section headers
readelf: Error: Section headers are not available!

There are no program headers in this file.
Comment 2 Jan Beich (mail not working) freebsd_committer 2017-01-14 04:35:13 UTC
Oops, ignore comment 1. I've modified WRKDIR to make comparison easier.
Comment 3 Jan Beich (mail not working) freebsd_committer 2017-01-14 18:12:12 UTC
Reverting Clang r287138 doesn't help unlike bug 216043. preamble() lacks __attribute__((gnu_inline)) but is used within the same translation unit.
Comment 4 Jan Beich (mail not working) freebsd_committer 2017-01-14 18:21:05 UTC
Created attachment 178890 [details]
fix, v0
Comment 5 Jan Beich (mail not working) freebsd_committer 2017-01-14 19:02:41 UTC
Created attachment 178891 [details]
alternative fix, v0
Comment 6 Jan Beich (mail not working) freebsd_committer 2017-01-14 20:10:34 UTC
Comment on attachment 178890 [details]
fix, v0

This version also fixes build with -O0 or WITH_DEBUG=1 using older Clang or GCC:

$ make clean all WITH_DEBUG=
[...]
rtl_power.o: In function `fix_fft':
rtl_power.c:(.text+0x420): undefined reference to `FIX_MPY'
rtl_power.c:(.text+0x449): undefined reference to `FIX_MPY'
rtl_power.c:(.text+0x478): undefined reference to `FIX_MPY'
rtl_power.c:(.text+0x4a1): undefined reference to `FIX_MPY'
rtl_adsb.o: In function `manchester':
rtl_adsb.c:(.text+0x3de): undefined reference to `preamble'
rtl_adsb.c:(.text+0x4b3): undefined reference to `single_manchester'
collect2: error: ld returned 1 exit status
Comment 7 commit-hook freebsd_committer 2017-01-16 21:19:06 UTC
A commit references this bug:

Author: martymac
Date: Mon Jan 16 21:18:27 UTC 2017
New revision: 431703
URL: https://svnweb.freebsd.org/changeset/ports/431703

Log:
  Fix build with clang 4.0

  PR:		216048
  Submitted by:	jbeich

Changes:
  head/comms/rtl-sdr/Makefile
Comment 8 Ganael LAPLANCHE freebsd_committer 2017-01-16 21:20:01 UTC
Committed, thanks Jan!
Comment 9 commit-hook freebsd_committer 2017-01-19 05:37:01 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jan 19 05:36:25 UTC 2017
New revision: 431850
URL: https://svnweb.freebsd.org/changeset/ports/431850

Log:
  MFH: r431703 by martymac

  Fix build with clang 4.0

  PR:		216048
  Submitted by:	jbeich
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q1/
  branches/2017Q1/comms/rtl-sdr/Makefile