I am experiencing an issue with my Google Cloud IDX workspace where the linker (ld) is not being found, even though my dev.nix file is configured to include the necessary stdenv.cc.cc.lib package, which should provide the C/C++ compiler and linker. This prevents me from building software that requires linking.
Problem Description:
The ld command is not found in my IDX workspace terminal, even after rebuilding the workspace with a minimal dev.nix file that includes pkgs.stdenv.cc.cc.lib. The gcc and g++ compilers are correctly installed and working.
Expected Result:
I expect the ld --version command to show the linker version information, and which ld to show a path to the linker executable within /nix/store.
Actual Result:
- ld --version returns: “ld is not installed, but available in the following packages, pick one to run it, Ctrl+C to cancel.”
- which ld returns: “which: no ld in (…)” (shows no path)
- echo $NIX_PATH returns: “/nix/var/nix/profiles/per-user/root/channels”
Steps to Reproduce:
-
Created a new IDX workspace using the “Blank” template.
-
Created a .idx/dev.nix file with the following minimal contents:
{ pkgs, … }: {
channel = “stable-24.05”;
packages = [
pkgs.stdenv.cc.cc.lib # Only the C compiler for initial testing
pkgs.git # Include Git
];
}
-
Rebuilt the workspace using idx restart.
-
Opened a new terminal window within the workspace.
-
Ran the following commands:
gcc --version
g++ --version
ld --version
which ld
echo $NIX_PATH
nix-env -qaP | grep binutils
Troubleshooting Steps Already Taken:
- Verified that dev.nix includes pkgs.stdenv.cc.cc.lib.
- Rebuilt the IDX workspace multiple times using idx restart and the restart button.
- Tried a full stop/start of the workspace from the IDX dashboard.
- Opened new terminal windows after each rebuild.
- Created a completely new workspace with the minimal dev.nix configuration.
- Attempted to source the Nix profile manually (source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh), but the file does not exist.
- Checked for conflicting shell configuration files (none found).
Request:
Please investigate why the linker (ld) is not being correctly provided in my IDX workspace environment, despite the dev.nix configuration including pkgs.stdenv.cc.cc.lib. This is preventing me from building software that requires linking. It appears the Nix environment is not being initialized correctly within the workspace.
Thank you.