Bug 230603 - astro/kstars: fails to build with LLD 7
Summary: astro/kstars: fails to build with LLD 7
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: freebsd-kde (group)
URL:
Keywords: needs-patch
Depends on:
Blocks: 214864 230355
  Show dependency treegraph
 
Reported: 2018-08-13 21:35 UTC by Jan Beich
Modified: 2018-12-29 18:50 UTC (History)
2 users (show)

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


Attachments
untested patch (1.67 KB, patch)
2018-08-14 05:56 UTC, Tobias C. Berner
no flags Details | Diff
v2 (fix typo) (1.69 KB, patch)
2018-08-14 06:04 UTC, Tobias C. Berner
no flags Details | Diff
v2 (2.74 KB, patch)
2018-12-26 10:47 UTC, Tobias C. Berner
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2018-08-13 21:35:13 UTC
$ poudriere jail -cj clang7 -a amd64 -v projects/clang700-import -m svn+https
$ poudriere testport -j clang7 astro/kstars
[...]
ld: error: unknown -z value: nodump
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/kstars-2.9.7_1,1.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2018-08-13 21:36:41 UTC
Can be worked around via LLD_UNSAFE.
Comment 2 Tobias C. Berner freebsd_committer freebsd_triage 2018-08-14 05:56:47 UTC
Created attachment 196188 [details]
untested patch

Hi there

Could you give the attached (untested) patch a try?

mfg Tobias
Comment 3 Tobias C. Berner freebsd_committer freebsd_triage 2018-08-14 06:04:07 UTC
Created attachment 196189 [details]
v2 (fix typo)
Comment 4 Jan Beich freebsd_committer freebsd_triage 2018-08-14 11:38:35 UTC
Comment on attachment 196189 [details]
v2 (fix typo)

Still fails: https://ptpb.pw/o_rN

ld: error: unknown -z value: nodump
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 5 Jan Beich freebsd_committer freebsd_triage 2018-08-14 12:26:07 UTC
Looks like LLD < 7 silently accepts any -z argument:

  $ cc -Wl,-z,whatever /path/to/test.c
Comment 6 Jan Beich freebsd_committer freebsd_triage 2018-08-14 12:28:26 UTC
Comment on attachment 196189 [details]
v2 (fix typo)

>++        execute_process(COMMAND ${CMAKE_LINKER} "-v" OUTPUT_VARIABLE LD_VERSION)

CMakeCache.txt contains CMAKE_LINKER:FILEPATH=/usr/local/bin/ld. Did you mean ${CMAKE_CXX_COMPILER} "-Wl,--version" ? The build doesn't invoke linker directly.
Comment 7 Jan Beich freebsd_committer freebsd_triage 2018-08-14 12:36:46 UTC
(In reply to Jan Beich from comment #5)
> Looks like LLD < 7 silently accepts any -z argument:
>
>   $ cc -Wl,-z,whatever /path/to/test.c

Old behavior was similar to BFD linker.

$ cc -fuse-ld=bfd -Wl,-z,whatever /path/to/test.c
$ cc -fuse-ld=/usr/local/bin/ld.bfd -Wl,-z,whatever /path/to/test.c
/usr/local/bin/ld.bfd: warning: -z whatever ignored.

$ cc -fuse-ld=gold -Wl,-z,whatever /path/to/test.c
/usr/local/bin/ld.gold: whatever: unknown -z option
/usr/local/bin/ld.gold: use the --help option for usage information
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 8 Ed Maste freebsd_committer freebsd_triage 2018-08-14 13:20:04 UTC
(In reply to Jan Beich from comment #7)
Yes, older lld silently ignored unknown -z options while 7.x exits with an error.

interpose - marks the object as an interposer
nodump    - marks the object as not available to dldump
Comment 9 Ed Maste freebsd_committer freebsd_triage 2018-09-14 13:53:53 UTC
lld -z nodump patch in https://reviews.freebsd.org/D17173
Comment 10 Ed Maste freebsd_committer freebsd_triage 2018-09-14 16:25:15 UTC
And upstream patch posted for review: https://reviews.llvm.org/D52096

But after writing the patch Mark found that dldump was apparently added only for emacs: http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg01022.html

Thus IMO the patch attached to this PR is the right way to go: just drop the flag from the linking invocation.
Comment 11 Tobias C. Berner freebsd_committer freebsd_triage 2018-12-26 10:47:32 UTC
Created attachment 200521 [details]
v2

another try.
Comment 12 commit-hook freebsd_committer freebsd_triage 2018-12-29 18:47:41 UTC
A commit references this bug:

Author: tcberner
Date: Sat Dec 29 18:47:12 UTC 2018
New revision: 488682
URL: https://svnweb.freebsd.org/changeset/ports/488682

Log:
  astro/kstars: fix linking with lld7

  kstars tries to pass -z nodump to the linker, which is not supported by lld7.

  This patch adds a little CMake function to check whether the linker accepts that flag,
  and if not does not add it.

  PR:		230603
  Reported by:	jbeich

Changes:
  head/astro/kstars/files/
  head/astro/kstars/files/patch-git_b7d677a