Bug 219089 - audio/openal-soft: cannot preempt symbol (WITH_LLD_IS_LD)
Summary: audio/openal-soft: cannot preempt symbol (WITH_LLD_IS_LD)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-ports-bugs mailing list
URL:
Keywords:
Depends on: 219718
Blocks: 214864
  Show dependency treegraph
 
Reported: 2017-05-05 21:34 UTC by O. Hartmann
Modified: 2018-09-26 15:59 UTC (History)
3 users (show)

See Also:


Attachments
lang/openal-soft: set LLD_UNSAFE (1.32 KB, patch)
2017-08-22 20:11 UTC, Ed Maste
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2017-05-05 21:34:22 UTC
Recent CURRENT (12.0-CURRENT #58 r317830: Fri May  5 16:57:40 CEST 2017 amd64) miscompiles port audio/openal-soft with the error shown below. CURRENT is built with option set WITH_LLD_IS_LD=yes.

[...]
[ 98%] Linking C executable openal-info
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/openal-info.dir/link.txt --verbose=1
/usr/bin/cc -std=c11 -O2 -pipe -O3  -fstack-protector -fno-strict-aliasing -O2 -pipe -O3  -fstack-protector -fno-strict-aliasing   -fstack-protector CMakeFiles/openal-info.dir/utils/openal-info.c.o  -o openal-info -Wl,-rpath,/usr/ports/audio/openal-soft/work/openal-soft-1.17.2: libopenal.so.1.17.2 libcommon.a -lpthread -lm -pthread 
/usr/bin/ld: error: /usr/ports/audio/openal-soft/work/openal-soft-1.17.2/utils/openal-info.c:(function main): cannot preempt symbol 'alcIsExtensionPresent' defined in libopenal.so.1.17.2
Comment 1 Nikolai Lifanov freebsd_committer 2017-07-06 01:49:37 UTC
Liking against openal-soft linked with ld.bfd doesn't work with LLD either.
For example, games/tome4 is one of the things that won't link.
Comment 2 Jan Beich freebsd_committer 2017-07-22 18:32:22 UTC
(In reply to Nikolai Lifanov from comment #1)
Can show the error log? games/tome4 seems to build fine against audio/openal-soft built with LDFLAGS += -fuse-ld=bfd, at least after base r321369.
Comment 3 Ed Maste freebsd_committer 2017-08-18 13:52:33 UTC
This is another case of ports trying to preempt symbols with protected visibility - see comment 5 on PR 219524 (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219524#c5) for some more details.
Comment 4 Nikolai Lifanov freebsd_committer 2017-08-18 13:55:16 UTC
I haven't tried this with llvm/clang/lld 5.0.0 yet.
Hold on and I'll see if I can reproduce this on latest head...
Comment 5 Nikolai Lifanov freebsd_committer 2017-08-18 14:17:37 UTC
This is still a problem on latest head:

/usr/bin/ld.lld: error: cannot preempt symbol: alcIsExtensionPresent
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(openal_get_devices)

/usr/bin/ld.lld: error: cannot preempt symbol: alcGetString
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(openal_get_devices)

/usr/bin/ld.lld: error: cannot preempt symbol: alcGetString
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(openal_get_devices)

/usr/bin/ld.lld: error: cannot preempt symbol: alcOpenDevice
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(init_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alcCreateContext
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(init_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alcMakeContextCurrent
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(init_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alDistanceModel
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(init_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alcCloseDevice
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(init_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alcMakeContextCurrent
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(deinit_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alcDestroyContext
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(deinit_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alcCloseDevice
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(deinit_openal)

/usr/bin/ld.lld: error: cannot preempt symbol: alGenBuffers
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(loadsoundLua)

/usr/bin/ld.lld: error: cannot preempt symbol: alGenSources
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(loadsoundLua)

/usr/bin/ld.lld: error: cannot preempt symbol: alBufferData
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(loadsoundLua)

/usr/bin/ld.lld: error: cannot preempt symbol: alListenerf
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(audio_enable)

/usr/bin/ld.lld: error: cannot preempt symbol: alListener3f
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(audio_enable)

/usr/bin/ld.lld: error: cannot preempt symbol: alDistanceModel
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(audio_enable)

/usr/bin/ld.lld: error: cannot preempt symbol: alDeleteBuffers
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(soundCollectLua)

/usr/bin/ld.lld: error: cannot preempt symbol: alGenSources
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(soundNewSource)

/usr/bin/ld.lld: error: cannot preempt symbol: alSourcei
>>> defined in ../../../../../../local/lib/libopenal.so
>>> referenced by ../src/music.c
>>>               ../obj/Release/TEngine/music.o:(soundNewSource)

/usr/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [TEngine.make:111: ../bin/Release/t-engine] Error 1
gmake: *** [Makefile:17: TEngine] Error 2
Comment 6 Ed Maste freebsd_committer 2017-08-22 20:11:00 UTC
Created attachment 185676 [details]
lang/openal-soft: set LLD_UNSAFE
Comment 7 commit-hook freebsd_committer 2017-08-30 19:41:16 UTC
A commit references this bug:

Author: emaste
Date: Wed Aug 30 19:40:15 UTC 2017
New revision: 448999
URL: https://svnweb.freebsd.org/changeset/ports/448999

Log:
  audio/openal-soft: set LLD_UNSAFE

  Linking with LLD currently fails due to preemption of symbols with
  protected visibility in a shared object:

  /usr/bin/ld: error: cannot preempt symbol: alIsExtensionPresent
  >>> defined in libopenal.so.1.18.0
  >>> referenced by examples/altonegen.c
  >>>               CMakeFiles/altonegen.dir/examples/altonegen.c.o:(main)

  /usr/bin/ld: error: cannot preempt symbol: alcGetCurrentContext
  >>> defined in libopenal.so.1.18.0
  >>> referenced by examples/altonegen.c
  >>>               CMakeFiles/altonegen.dir/examples/altonegen.c.o:(main)

  /usr/bin/ld: error: cannot preempt symbol: alcGetContextsDevice
  >>> defined in libopenal.so.1.18.0
  >>> referenced by examples/altonegen.c
  >>>               CMakeFiles/altonegen.dir/examples/altonegen.c.o:(main)
  ...

  (Ports that depend on audio/openal-soft may also need to be tagged with
  LLD_UNSAFE.)

  PR:		219089
  Approved by:	kwm
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/audio/openal-soft/Makefile
Comment 8 commit-hook freebsd_committer 2017-12-29 16:24:51 UTC
A commit references this bug:

Author: emaste
Date: Fri Dec 29 16:24:16 UTC 2017
New revision: 457512
URL: https://svnweb.freebsd.org/changeset/ports/457512

Log:
  audio/alure: set LLD_UNSAFE

  Linking with LLD currently fails due to preemption of symbols with
  protected visibility in a shared object:

  /usr/bin/ld: error: cannot preempt symbol: alureInitDevice
  >>> defined in libalure.so.1.2.0
  >>> referenced by examples/alurestream.c
  >>>               CMakeFiles/alurestream.dir/examples/alurestream.o:(main)

  For now set LLD_UNSAFE=yes so that the port will continue to link with
  ld.bfd if /usr/bin/ld is lld, until the issue can be addressed (with a
  change in openal-soft or in lld).

  PR:		214864, 219089
  Approved by:	portmgr (LLD_UNSAFE blanket)
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/audio/alure/Makefile
Comment 9 Ed Maste freebsd_committer 2018-03-28 00:52:28 UTC
Workaround committed in r448999
Comment 10 Jan Beich freebsd_committer 2018-09-26 15:44:03 UTC
I can't reproduce on /branches/clang700-import, see https://ptpb.pw/_Fp7 (amd64) and https://ptpb.pw/LGjr (i386). In other words, consumers may need to convert

  LLD_UNSAFE=	yes

into

  USES=		compiler

  .include <bsd.port.pre.mk>

  .if ${COMPILER_VERSION} < 70 && ${CC} == cc && ${CXX} == c++ && ${/usr/bin/ld:L:tA} == /usr/bin/ld.lld
  LLD_UNSAFE=	yes
  .endif
Comment 11 Jan Beich freebsd_committer 2018-09-26 15:59:19 UTC
Oops, after explicitly passing -fuse-ld=lld i386 appears to be still affected but amd64 is not. I'm not sure what this means yet other than the proposed conditional is going to be even more ugly.