Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 878317 - app-mobilephone/scrcpy-1.24-r1: ld.lld: error: undefined symbol: main
Summary: app-mobilephone/scrcpy-1.24-r1: ld.lld: error: undefined symbol: main
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-25 22:15 UTC by Luke-Jr
Modified: 2022-11-19 10:59 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log,37.55 KB, text/plain)
2022-10-25 22:15 UTC, Luke-Jr
Details
emerge --info (emerge--info.ryuu,9.67 KB, text/plain)
2022-10-25 22:15 UTC, Luke-Jr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2022-10-25 22:15:13 UTC
Created attachment 825463 [details]
build log

Disabling lld builds fine
Comment 1 Luke-Jr 2022-10-25 22:15:41 UTC
Created attachment 825465 [details]
emerge --info
Comment 2 Ionen Wolkens gentoo-dev 2022-10-25 22:27:40 UTC
fwiw I can reproduce on amd64

builds fine with lld if I use clang though, only fails with gcc+lld
Comment 3 Ionen Wolkens gentoo-dev 2022-10-25 22:33:21 UTC
Also builds fine with gcc+lld I add -fno-lto to CFLAGS (this package uses lto by default)
Comment 4 Ionen Wolkens gentoo-dev 2022-10-25 22:42:48 UTC
(In reply to Ionen Wolkens from comment #3)
> Also builds fine with gcc+lld I add -fno-lto to CFLAGS (this package uses
> lto by default)
Oh yeah, main thing is the error you get when you don't have llvmgold and try to use -flto with gcc+lld (I don't keep it around, so I don't expect gcc+lld lto to work).

Ideally be nice if package didn't randomly pass -flto, but if had llvmgold it'd probably work (haven't tried).
Comment 5 Ionen Wolkens gentoo-dev 2022-10-25 23:12:41 UTC
Or more specifically I "assume" you have llvm[-binutils-plugins], just noticed llvmgold is just doing a symlink.
Comment 6 Luke-Jr 2022-10-25 23:16:15 UTC
[ebuild   R    ] sys-devel/llvm-14.0.6-r2:14::gentoo  USE="binutils-plugin libffi ncurses xml -debug -doc -exegesis -libedit -test -verify-sig -xar -z3" LLVM_TARGETS="(AArch64) (AMDGPU) (ARM) (AVR) (BPF) (Hexagon) (Lanai) (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) (-ARC) (-CSKY) (-M68k)" 0 KiB
Comment 7 Ionen Wolkens gentoo-dev 2022-10-25 23:23:03 UTC
Hrm, thought that was letting lto work but maybe I'm wrong? Can't say I really ever tried to use gcc+lld with -flto as I don't expect much from that.
Comment 8 Ionen Wolkens gentoo-dev 2022-10-26 00:09:55 UTC
(In reply to Ionen Wolkens from comment #4)
> Ideally be nice if package didn't randomly pass -flto
tl;dr this bug is just about that

although you could work around it by adding -fno-lto to your CFLAGS if want to keep using lld on packages that do -flto by default
Comment 9 Bernard Cafarelli gentoo-dev 2022-11-19 10:49:07 UTC
I was focusing on trying gcc+lld manually, but then I realized in the ebuild meson options have -Db_lto=true (coming from upstream build options). So this was in ebuild directly that lto was enabled, sorry for that

I will push a revbump with USE=lto or similar, hopefully it fixes it for you
Comment 10 Larry the Git Cow gentoo-dev 2022-11-19 10:58:03 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06d1ca8561cf0bd6ee0a3a8afa8e6aaa09e05a14

commit 06d1ca8561cf0bd6ee0a3a8afa8e6aaa09e05a14
Author:     Bernard Cafarelli <voyageur@gentoo.org>
AuthorDate: 2022-11-19 10:57:04 +0000
Commit:     Bernard Cafarelli <voyageur@gentoo.org>
CommitDate: 2022-11-19 10:58:01 +0000

    app-mobilephone/scrcpy: add USE flag for LTO
    
    This was hardcoded in ebuild
    
    Closes: https://bugs.gentoo.org/878317
    Signed-off-by: Bernard Cafarelli <voyageur@gentoo.org>

 app-mobilephone/scrcpy/metadata.xml          |  6 +++++
 app-mobilephone/scrcpy/scrcpy-1.24-r2.ebuild | 37 ++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
Comment 11 Ionen Wolkens gentoo-dev 2022-11-19 10:59:53 UTC
Unless upstream is doing something special with lto, generally these should just be left disabled rather than giving a USE.

Nothing stops someone from just adding -flto to their CFLAGS if they actually want it, and will probably it setup the right way for it to work.