Skip to content

libstdc++.so.6 not available in template #76

@hknlof

Description

@hknlof

Not a C++ developer. I assume enough C and especially C++ developers use libstdc++.so.6. When building a project, which downstream depends on it, I receive the following failure:

ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory

Hence, it might make sense to add the LD_LIBRARY_PATH?

Full flake.nix:

{
  description = "A Nix-flake-based C/C++ development environment";

  inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";

  outputs = { self, nixpkgs }:
    let
      supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
      forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
        pkgs = import nixpkgs { inherit system; };
      });
    in
    {
      devShells = forEachSupportedSystem ({ pkgs }: {
        default = pkgs.mkShell.override {} {
            packages = with pkgs; [
              clang-tools
              cmake
              codespell
              conan
              cppcheck
              doxygen
              gtest
              lcov
              vcpkg
              vcpkg-tool
            ];
            # Change, that worked and as far as I understand would not violate the nix-way
            # https://discourse.nixos.org/t/how-to-solve-libstdc-not-found-in-shell-nix/25458/16
            LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ];
          };
      });
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions