Skip to content

glib: propagate dependency on pcre #15046

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

Closed
wants to merge 1 commit into from
Closed

glib: propagate dependency on pcre #15046

wants to merge 1 commit into from

Conversation

groxxda
Copy link
Contributor

@groxxda groxxda commented Apr 28, 2016

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

glib is configured to use the system libpcre.
pcre is listed as a private dependency in glibs .pc file but nixos has no such distinction.

Sorry, something went wrong.

glib is configured to use the system libpcre.
pcre is listed as a private dependency in glibs .pc file but nixos has no such distinction.
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @vcunat, @urkud and @lethalman to be potential reviewers

@copumpkin
Copy link
Member

Thanks, I ran into a similar issue just yesterday

@lucabrunox
Copy link
Contributor

lucabrunox commented Apr 28, 2016

What's the issue? Most probably this is i not the right fix, given glib never had to propagate pcre. What's the error specifically?

@groxxda
Copy link
Contributor Author

groxxda commented Apr 28, 2016

I will review if propagating is the right decision.

From (Compiling the GLib package: GLib Reference Manual)[https://developer.gnome.org/glib/stable/glib-building.html]:

GRegex uses the PCRE library for regular expression matching. The default is to use the internal version of PCRE that is patched to use GLib for memory management and Unicode handling. If you prefer to use the system-supplied PCRE library you can pass the --with-pcre=system option to, but it is not recommended

So it would probably be better to use the internal pcre version in the first place.

@groxxda
Copy link
Contributor Author

groxxda commented Apr 28, 2016

I tested GRegex without the propagated libpcre and it seemed to work.

What led me to believe propagation was required is the output of CMake when including glib-2.0:

Package libpcre was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpcre.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libpcre', required by 'glib-2.0', not found

I'm absolutely clueless if this is a bug in autoconf/pkg-config (should ignore Requires.private completely when building shared?) or whether .pc files should be available even for private dependencies.

Any thoughts?

@lucabrunox
Copy link
Contributor

lucabrunox commented Apr 28, 2016

The fact is that for other distros it may be useful, but probably for nix it's not because of rpath. Maybe we should patch pkgconfig to ignore private libs for dynamic linking? @vcunat @edolstra

@vcunat
Copy link
Member

vcunat commented Apr 28, 2016

We already have a patch changing the private deps somehow, in pkgs/development/tools/misc/pkgconfig/requires-private.patch. I don't remember exact details. IIRC there wasn't broad consensus about the meaning of requires-private, so different packages expected different things from it...

@lucabrunox
Copy link
Contributor

lucabrunox commented Apr 28, 2016

But I wonder why we're having problems with it right now... what changed since few weeks? Glib obviously has always been linked to other programs with pkgconfig.
Perhaps pcre was included during the build processes everytime for some other reason? And now it's no more the case? I'd like to know the commit that changed this.

@groxxda
Copy link
Contributor Author

groxxda commented Apr 28, 2016

@lethalman The change was introduced in 6b8a8ca and merged with closure-size into master

@vcunat
Copy link
Member

vcunat commented Apr 29, 2016

I agree the changes are likely from closure-size merge – there were also later commits adding the pcre dependency back after "splitting" pcre.

@lucabrunox
Copy link
Contributor

lucabrunox commented May 27, 2016

@vcunat what about avoid touching pkgconfig and removing pcre from glib private require? It's clearly put by glib devs here https://github.com/GNOME/glib/blob/master/glib-2.0.pc.in but there's no need in nix because glib links directly to libpcre, and libpcre headers are not exposed.

@vcunat
Copy link
Member

vcunat commented May 27, 2016

IIRC *.private are only meant to be used when linking statically – that way you would need to link explicitly with anything glib uses, but we rarely use static linking.

@lucabrunox
Copy link
Contributor

lucabrunox commented May 27, 2016

From https://people.freedesktop.org/~dbn/pkg-config-guide.html:
"On the other hand, libraries from Requires.private will only be included when static linking."

Given pkg-config --libs doesn't show libpcre, I believe it's something wrong with the m4 of the configure stuff:

$ env|grep pcre
$ pkg-config --print-errors --cflags --libs glib-2.0
-I/nix/store/dpfrpllpqmw5b9pdhshj5g3hyikw3b79-glib-2.48.1-dev/include/glib-2.0 -I/nix/store/w15z2dphj6g1kij164i74c6mvwaykf0c-glib-2.48.1/lib/glib-2.0/include -L/nix/store/w15z2dphj6g1kij164i74c6mvwaykf0c-glib-2.48.1/lib -lglib-2.0

@lucabrunox
Copy link
Contributor

Ah looks like it only happens with cmake projects... like this: http://hydra.nixos.org/build/36252754/log/raw

@lucabrunox
Copy link
Contributor

lucabrunox commented May 27, 2016

And I think it's because of this line: https://github.com/Kitware/CMake/blob/d08281094948eaefb495040f4a7bb45cba17a5a7/Modules/FindPkgConfig.cmake#L119

Looks like pkg-config --static is invoked even when doing a dynamic only build. And using --static indeed results in an error about pcre.

So looks like if we ever want to support static linking we still need to use propagatedBuildInputs unfortunately.

@vcunat
Copy link
Member

vcunat commented May 27, 2016

Ah, apparently cmake always prepares variables for both cases. The PR will increase build-time closure, but I can't see a better solution ATM.

@lucabrunox
Copy link
Contributor

@vcunat shall this go to staging first?

@vcunat
Copy link
Member

vcunat commented May 27, 2016

Yes, better that way, I think.

@edolstra
Copy link
Member

If it's a cmake problem, wouldn't it be better to fix cmake? Propagated build inputs are not a good idea in general...

@lucabrunox
Copy link
Contributor

@edolstra it's not a problem. We need a policy about support for static builds. If you want to do a static build you need that pcre being propagated.

@vcunat
Copy link
Member

vcunat commented May 30, 2016

Well, it's true that first we would need pcre that creates static libraries. I think that's typically done with different compiler flags, so it would better be done in a separate build anyway.

@joachifm
Copy link
Contributor

Was there consensus on this? Looks to me like a different solution is preferred?

@FRidh
Copy link
Member

FRidh commented Jul 15, 2017

Last time nobody responded so closing this now.

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

Successfully merging this pull request may close these issues.

None yet

8 participants