Bug 248738 - multimedia/libv4l: Fix build with -fno-common (clang 11 and gcc 10)
Summary: multimedia/libv4l: Fix build with -fno-common (clang 11 and gcc 10)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Niclas Zeising
URL:
Keywords:
Depends on:
Blocks: 248756
  Show dependency treegraph
 
Reported: 2020-08-18 21:11 UTC by Dimitry Andric
Modified: 2020-08-20 21:02 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (multimedia)
zeising: merge-quarterly?


Attachments
Fix build with -fno-common (clang 11 and gcc 10) (2.98 KB, patch)
2020-08-18 21:11 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 Dimitry Andric freebsd_committer freebsd_triage 2020-08-18 21:11:43 UTC
Created attachment 217323 [details]
Fix build with -fno-common (clang 11 and gcc 10)

In base r364284, I imported clang 11 into head. Like gcc 10, it now defaults to -fno-common, meaning that duplicated global symbols will most likely lead to link errors. Here is a patch to fix this port's duplicated global symbols.
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2020-08-18 22:50:44 UTC
Hi,

The patch doesn't look fully right.

Can you double check that the symbols in question gets declared somewhere?

Else it won't be possible to load this library, due to missing symbols.

--HPS
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2020-08-19 08:51:04 UTC
(In reply to Hans Petter Selasky from comment #1)
Yes, the symbols get defined in lib/libdvbv5/dvb-v5.c. They were doubly defined in a .h file, which is incorrect.

The symbols for which I changed the declarations in the .h file to extern are in the .so:

% nm -D /usr/local/lib/libdvbv5.so.0.0.0 | grep -F -e delivery_system_name -e dvb_v5_name -e fe_bandwidth_name -e fe_code_rate_name -e fe_guard_interval_name -e fe_hierarchy_name -e fe_inversion_name -e fe_modulation_name -e fe_pilot_name -e fe_rolloff_name -e fe_tone_name -e fe_transmission_mode_name -e fe_voltage_name
00000000000558b0 D delivery_system_name
0000000000055670 D dvb_v5_name
000000000001e360 R fe_bandwidth_name
00000000000553f0 D fe_code_rate_name
0000000000055530 D fe_guard_interval_name
0000000000055590 D fe_hierarchy_name
0000000000055600 D fe_inversion_name
0000000000055460 D fe_modulation_name
0000000000055620 D fe_pilot_name
0000000000055640 D fe_rolloff_name
00000000000555e0 D fe_tone_name
00000000000554e0 D fe_transmission_mode_name
00000000000555c0 D fe_voltage_name
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2020-08-19 11:24:05 UTC
Perfect. Need to submit this patch upstream too. I'll see if I can handle.

Approved.
Comment 4 Hans Petter Selasky freebsd_committer freebsd_triage 2020-08-19 11:44:02 UTC
Upstream patch:

commit afb123618b087f3ca2305b84fb004624662e52f0
Author: David Seifert <soap@gentoo.org>
Date:   Wed Feb 26 11:07:29 2020 +0100

    Fix GCC 10 / -fno-common
    
    * GCC 10 switches its default symbol emission mode
      to cause linker errors when an object is defined
      more than once.
    
    Bug: https://bugs.gentoo.org/706756
    Signed-off-by: David Seifert <soap@gentoo.org>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Comment 5 commit-hook freebsd_committer freebsd_triage 2020-08-19 21:16:53 UTC
A commit references this bug:

Author: zeising
Date: Wed Aug 19 21:16:38 UTC 2020
New revision: 545453
URL: https://svnweb.freebsd.org/changeset/ports/545453

Log:
  multimeida/libv4l: Fix build with -fno-common

  Add a patch from upstream to fix the build of multimedia/libv4l with
  -fno-common, which is the default with llvm 11.

  PR:		248738
  Reported by:	dim
  MFH:		2020Q3

Changes:
  head/multimedia/libv4l/files/patch-afb12361.c
Comment 6 Niclas Zeising freebsd_committer freebsd_triage 2020-08-19 21:18:57 UTC
Committed with upstream patch.  Awaiting MFH
Comment 7 commit-hook freebsd_committer freebsd_triage 2020-08-20 19:27:45 UTC
A commit references this bug:

Author: zeising
Date: Thu Aug 20 19:26:59 UTC 2020
New revision: 545554
URL: https://svnweb.freebsd.org/changeset/ports/545554

Log:
  MFH: r545453

  multimeida/libv4l: Fix build with -fno-common

  Add a patch from upstream to fix the build of multimedia/libv4l with
  -fno-common, which is the default with llvm 11.

  PR:		248738
  Reported by:	dim

  Approved by:	ports-secteam (joenum)

Changes:
_U  branches/2020Q3/
  branches/2020Q3/multimedia/libv4l/files/patch-afb12361.c
Comment 8 Niclas Zeising freebsd_committer freebsd_triage 2020-08-20 21:02:26 UTC
All done and merged.