Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker options in dyaml.pc not correct? #137

Open
russel opened this issue May 18, 2018 · 3 comments
Open

Linker options in dyaml.pc not correct? #137

russel opened this issue May 18, 2018 · 3 comments

Comments

@russel
Copy link
Contributor

russel commented May 18, 2018

The libgtkd-3-dev package on Debian Sid installs /usr/lib/x86_64-linux-gnu/pkgconfig/gtkd-3.pc:

Name: GtkD
Description: A D binding and OO wrapper for GTK+.
Version: 3.8.2
Libs: -L-L/usr/lib/x86_64-linux-gnu/ -L-lgtkd-3 -L-ldl
Cflags: -I/usr/include/d/gtkd-3/

which works for dmd and ldc2, I suspect perhaps not for gdc. D-YAML creates:

prefix=/home/users/russel/Built
libdir=${prefix}/lib
includedir=${prefix}/include

Name: dyaml
Description: YAML parser and emitter for the D programming language.
Version: 0.6.5
Requires.private: tinyendian
Libs: -L${libdir} -ldyaml
Cflags: -I${includedir}/d/yaml

Which doesn't work fordmd or ldc2 without adding a -L in front of the Libs options. So who has it right GtkD or D-YAML?

@ximion
Copy link
Member

ximion commented May 18, 2018

Both, actually, although GtkD is probably a bit more correct.
Since D has no ABI stability and you can't use any library compiled with one D compiler with code compiled with another D compiler, the libraries and therefore the .pc files are generally tied to the respective compiler and compiler version that the code was originally compiled with.

In pkg-config files, we generally expect GCC/Clang compatible compiler flags, which makes the dyaml case correct. At the same time though, ldc and dmd are not fully compatible to GCC/Clang's arguments, therefore GtkD could be correct.

What actually happens though is that at least when using Meson, Meson will transparently convert the flags to whatever the currently used D compiler is comfortable with, and AFAIK dub will do the same.

@russel
Copy link
Contributor Author

russel commented May 18, 2018

OK. I am stuck with Dub and SCons for build since Meson cannot build Unit-Threaded stuff because there is no unitary build. (I just do a small hack for the SCons build which is irritating but I can cope.)

@ximion
Copy link
Member

ximion commented May 18, 2018

Meson supports unity builds, but the D support likely doesn't. Implementing this should be easy though.

DMD and LDC not following GCC/Clang flags is an incredible nuisance, so much so that we actually ship a script in Debian as part of the dlang debhelper support to work around this issue.
Dub should actually already deal with pkg-config flags correctly, if not this should be fixed. For SCons, you might find the code we ship in Debian as part of our packaging helpers useful: https://salsa.debian.org/d-team/dh-dlang/blob/master/gcc-to-ldc-flags.py (it's a hack, but the best we got at time to work around the compiler flag differences).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants