gentoo / dlang

[MIRROR] D programming language ebuild repository
https://gitweb.gentoo.org/repo/user/dlang.git
GNU General Public License v2.0
30 stars 25 forks source link

help request - libphobos2 error in my package #83

Open KingDuckZ opened 4 years ago

KingDuckZ commented 4 years ago

I wrote this ebuild which I'd like to contribute to this overlay:

# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DESCRIPTION="A command line hashing program based on the tiger algorithm"
HOMEPAGE="https://alarmpi.no-ip.org/gitan/King_DuckZ/tigersum"
SRC_URI="https://alarmpi.no-ip.org/gitan/King_DuckZ/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/"${PN}"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 ~x86"
IUSE="default-tiger2"

DLANG_VERSION_RANGE="2.075-"
DLANG_PACKAGE_TYPE="single"

DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND=""

inherit dlang meson

src_prepare() {
        eapply_user
        local emesonargs=(
                -Ddefault_tiger_version=$(usex default-tiger2 2 1)
        )
        meson_src_configure
}

The package is installing correctly but when I run tigersum --help I get this error:

tigersum: error while loading shared libraries: libphobos2-ldc-shared.so.90: cannot open shared object file: No such file or directory

Any idea what the problem might be and how I could fix my ebuild?

I'm compiling with ldc

sys-apps/tigersum-0.1::localrepo  USE="ldc2-1_20 -default-tiger2 -dmd-2_075 -dmd-2_076 -dmd-2_077 -dmd-2_078 -dmd-2_079 -dmd-2_080 -dmd-2_081 -dmd-2_082 -dmd
-2_083 -dmd-2_084 -dmd-2_085 -dmd-2_086 -dmd-2_087 -dmd-2_088 -dmd-2_089 -dmd-2_090 -gdc-9_2_0 -gdc-9_3_0 -ldc2-1_12 -ldc2-1_13 -ldc2-1_14 -ldc2-1_15 -ldc2-1_16 -ldc2-1_17 -l
dc2-1_18 -ldc2-1_19" 0 KiB
mleise commented 4 years ago

I'll check next time I'm on Linux. If the latest LDC2 is installed, this sounds like tigersum forgot about the rpath to the library. But it should be part of the default compiler options in LDC2's config file (from our ebuild at least) to set rpath correctly for newly compiled programs.

mleise commented 4 years ago

While the build process picked up LDFLAGS, it selects a D compiler by itself. I tried compiling with dmd-2_090 and it printed D compiler for the host machine: ldc2 (llvm 1.20.1 "LDC - the LLVM D compiler (1.20.1). See if there is a way to make the build process pick up the env vars set up in eclass/dlang.eclass -> dlang_foreach_config(). In particular DC, but also DLANG_VENDOR could be useful. Potentially also DLANG_LINKER_FLAG in case of problems with linker arguments.

Now on to the issue with the rpath. ebuild ... compile results in a working binary, but as soon as I type ebuild ... install the executable in the image path has the rpath reference removed.

mleise commented 4 years ago

I think you may be hitting https://github.com/mesonbuild/meson/issues/6541

KingDuckZ commented 4 years ago

I'm a little bit new to ebuilds and it's very possible there are mistakes in my script. Anyways, just the other day I learned about the toolchain-funcs eclass which provides tc-export. Maybe it would be good if there was something equivalent to ensure the appropriate compiler is being used for D as well. That would fix the problem with meson defaulting to the wrong compiler I think. But if DC is already set then I don't understand, normally meson should honour it.

If the rpath problem is a bug I'll ask on IRC to see if there are known workarounds for it. Is my ebuild the first one to use meson btw?

mleise commented 4 years ago

Outside of third party overlays that have this one as a dependency and may or may not be using meson you are the first. Congrats to your new can of worms. There's many like it, but this one is yours. :)

mleise commented 4 years ago

Additional warnings/errors from repoman: ebuild.minorsyn 5 sys-apps/tigersum/tigersum-0.1.ebuild: line 26: Ebuild contains leading spaces sys-apps/tigersum/tigersum-0.1.ebuild: line 27: Ebuild contains leading spaces sys-apps/tigersum/tigersum-0.1.ebuild: line 28: Ebuild contains leading spaces sys-apps/tigersum/tigersum-0.1.ebuild: line 29: Ebuild contains leading spaces sys-apps/tigersum/tigersum-0.1.ebuild: line 30: Ebuild contains leading spaces metadata.missing [fatal] 1 sys-apps/tigersum/metadata.xml