# Linker (ld) not found in Google Cloud IDX workspace despite correct dev.nix configuration

**URL:** <https://community.firebasestudio.dev/t/linker-ld-not-found-in-google-cloud-idx-workspace-despite-correct-dev-nix-configuration/9315>\
**Category:** General\
**Created:** [February 12, 2025, 3:33am UTC](https://community.firebasestudio.dev/t/linker-ld-not-found-in-google-cloud-idx-workspace-despite-correct-dev-nix-configuration/9315 "2025-02-12T03:33:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenjaminHD](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/benjaminhd/32/4305_2.png) [@BenjaminHD](https://community.firebasestudio.dev/u/BenjaminHD)\
**Post date:** [February 12, 2025, 3:33am UTC](https://community.firebasestudio.dev/t/linker-ld-not-found-in-google-cloud-idx-workspace-despite-correct-dev-nix-configuration/9315/1 "2025-02-12T03:33:13Z")

</div>

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:**

1. Created a new IDX workspace using the “Blank” template.

2. 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  
];  
}

1. Rebuilt the workspace using idx restart.

2. Opened a new terminal window within the workspace.

3. 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.

---

<div class="post-metadata">

**Author:** ![Alex](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/alex/32/218_2.png) [@Alex](https://community.firebasestudio.dev/u/Alex)\
**Post date:** [February 13, 2025, 1:13am UTC](https://community.firebasestudio.dev/t/linker-ld-not-found-in-google-cloud-idx-workspace-despite-correct-dev-nix-configuration/9315/2 "2025-02-13T01:13:54Z")

</div>

Want to first say thank you for the detailed post; very clear what the problem is.

I’m afraid I’m not a c++ expert so pardon me if this is dumb question. Is there a reason why you’re using `stdenv.cc.cc.lib` instead of `pkgs.gcc`? `pkgs.gcc` should provide the c/c++ compiler and the linker. stdenv.cc is used for nix internals (apologize if you’re building a nix package).

Thanks for trying out IDX!

---

<div class="post-metadata">

**Author:** ![BenjaminHD](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/benjaminhd/32/4305_2.png) [@BenjaminHD](https://community.firebasestudio.dev/u/BenjaminHD)\
**Post date:** [February 13, 2025, 5:35am UTC](https://community.firebasestudio.dev/t/linker-ld-not-found-in-google-cloud-idx-workspace-despite-correct-dev-nix-configuration/9315/3 "2025-02-13T05:35:25Z")

</div>

> [@Alex](#):
>
> I’m afraid I’m not a c++ expert so pardon me if this is dumb question. Is there a reason why you’re using `stdenv.cc.cc.lib` instead of `pkgs.gcc`? `pkgs.gcc` should provide the c/c++ compiler and the linker. stdenv.cc is used for nix internals (apologize if you’re building a nix package).

Hi Alex

Thank you. That seems to have solved my problem.
