Bug 234745

Summary: multimedia/mplayer: fails to build on i386 with lld as system linker
Product: Ports & Packages Reporter: Ed Maste <emaste>
Component: Individual Port(s)Assignee: Thomas Zander <riggs>
Status: Closed FIXED    
Severity: Affects Only Me CC: riggs
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 214864    

Description Ed Maste freebsd_committer freebsd_triage 2019-01-08 13:57:36 UTC
In PR comment 187 jbeich@ writes:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214864#c187

FreeType is disabled because iconv() detection fails which itself fails due to auto-enabled -pie. On amd64 configure appends -fpie, assuming shared libraries are built with -fPIC, but on i386 this is not required.

$ cat >a.c
#include <stdio.h>

int main()
{
  printf("Hello World\n");
  return 0;
}

$ cc a.c -pie
/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: .L.str in readonly segment; recompile object files with -fPIC
>>> defined in /tmp/a-5c8390.o
>>> referenced by a.c
>>>               /tmp/a-5c8390.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Ed Maste freebsd_committer freebsd_triage 2019-01-08 14:13:21 UTC
http://package18.nyi.freebsd.org/build.html?mastername=headi386PR214864-default&build=2019-01-05_21h00m02s
http://package18.nyi.freebsd.org/data/headi386PR214864-default/2019-01-05_21h00m02s/logs/errors/mplayer-1.3.0.20181224.log

> Checking for GUI ... yes 
> 
> Error: The GUI requires either FreeType or bitmap font support.
>
> Check "config.log" if you do not understand why it failed.
> ===>  Script "configure" failed unexpectedly.
Comment 2 Thomas Zander freebsd_committer freebsd_triage 2019-01-09 14:45:27 UTC
Adding

LDFLAGS_i386+=	-Wl,-z,notext

to ${PORTSDIR}/multimedia/mplayer/Makefile.options

fixes the build with lld and produces a (on my test setup) working binary of mplayer and mencoder.

Ed: From previous discussions around the lld topic I understood that this is the preferred solution. Could you quickly confirm, then I'll commit this.

Thank you.
Comment 3 Ed Maste freebsd_committer freebsd_triage 2019-01-09 15:03:42 UTC
(In reply to Thomas Zander from comment #2)

Yes, this is the most straightforward option and configures lld to act as ld.bfd did, so is a minimal change.
Comment 4 Thomas Zander freebsd_committer freebsd_triage 2019-01-09 17:00:54 UTC
Committed in r489814, see bug #214864