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

libsigc++ pkg-config file forces -std=c++11 #33534

Closed
jeroendehaas opened this issue Jan 6, 2018 · 0 comments
Closed

libsigc++ pkg-config file forces -std=c++11 #33534

jeroendehaas opened this issue Jan 6, 2018 · 0 comments

Comments

@jeroendehaas
Copy link
Contributor

jeroendehaas commented Jan 6, 2018

Issue description

Currently, the derivation for libsigc++ includes a patch that appends -std=c++11 to sigc++-2.0.pc. As a result a C++ project that uses libsigc++-2.0 may be interpreted according to a different standard than expected.

For instance, GCC 6.1 and higher by default interprets C++ code according to the C++14 standard and using libsigc++ via pkg-config effectively downgrades this to C++11.

The patch responsible seems to originate from the Debian project where it was introduced in 2015 when GCC 5 was their default compiler and removed in 2016 when they switched to GCC 6.

As a side note, I feel pkg-config files are not the place to force a certain c++ standard.

Steps to reproduce

  1. Create a c++ file that conforms to C++14 and higher (but not lower)
decltype(auto) cxx14() {
    return 0;
}
int main() {
    return cxx14();
}
  1. Create a nix expression, e.g. default.nix that lists gcc, pkgconfig and libsigcxx as buildInputs
with import <nixpkgs> {} ;
stdenv.mkDerivation rec {
    src = ./.;
    name = "repr";
    buildInputs = [ gcc pkgconfig libsigcxx];
}
  1. Enter nix-shell
  2. Run the following command
gcc `pkg-config --cflags --libs sigc++-2.0` file.cpp

Technical details

% nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 4.14.12, NixOS, 17.09.2631.0653b73bf61 (Hummingbird)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 1.11.16`
 - channels(root): `"nixos-17.09.2631.0653b73bf61"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants