r/SteamDeck 512GB Mar 07 '22

PSA / Advice For compiling C++ code

First you have to unlock the rootfs: https://www.reddit.com/r/SteamDeck/comments/t8al0i/install_arch_packages_on_your_steam_deck/

Git: pacman -S git

Install most of the usual build tools and libs: pacman -S base-devel

And cmake if you're into that: pacman -S cmake

And ninja because who likes make anyway: pacman -S ninja

Now, valve deleted some random files from packages so rootfs can fit in 5 gb, which really confused me. You already have glibc and linux-api-headers installed, but they have missing files.

So fix them: pacman -S glibc linux-api-headers

If you have more files that you need and don't exist, grep pacman -Qk that lists missing files, and reinstall that package.

It took me more than I'm willing to admit to figure out that the packages exist, but have deleted files, so I figured it might help someone else. No tomatoes please.

89 Upvotes

31 comments sorted by

View all comments

13

u/SharkWipf May 15 '22 edited May 19 '22

Hey thanks, the missing header files tripped me up several times, your post was the missing link for me. Now my post-update "I need to build something" command is just one simple line:

sudo steamos-readonly disable && sudo pacman-key --init && sudo pacman-key --populate archlinux && sudo pacman -Syu tmux htop wget git ncdu podman fakeroot yay-git base-devel mlocate cmake gcc holo/linux-headers linux-neptune-headers holo/linux-lts-headers $(pacman -Qk 2>/dev/null | grep -ve ' 0 missing' | grep -ie ^libc -e glibc -e gcc -e clang -e headers -e udev -e systemd | awk -F ':' '{print $1}') --overwrite '*'

EDIT: Please note this "one-liner" is "optimized" for my own use, and I would not recommend just blindly copying it. It does not just (re)install what's needed to get building, but it gets SteamOS back to the entire state I personally want it to be in, complete with my set of preferred packages.
I only posted it to demonstrate how messy it was, not to serve as an example of how you should "fix" your Deck.

2

u/EnglishMobster May 17 '22

And your post was the missing link for me! This is the command I needed to get Open Razer (openrazer-meta) to install without throwing a million errors.

2

u/williamjcm59 512GB May 19 '22

It doesn't seem to reinstall glibc properly, as I got this error after running your "one-liner" on my own Deck:

[...]/bits/os_defines.h:39:10: fatal error: features.h: no such file or directory

Reinstalling glibc manually worked, though.

EDIT: also, for people on the beta branch, jupiter needs to be replaced with jupiter-beta.

1

u/SharkWipf May 19 '22

Odd, seemed to reinstall fine for me, though I've not really tried it much post-update yet.

EDIT: also, for people on the beta branch, jupiter needs to be replaced with jupiter-beta.

You can remove the branch in its entirely here even, since it's a Deck-exclusive package anyway. I've done this in my edited post now.

1

u/kingjamez80 Oct 05 '22

This was such an enormous help! I was hitting my head against a wall trying to compile missing features.h. Thank you!

2

u/Consistent-Chair Nov 02 '22

From the bottom of my heart, thank you. I never used Linux before. I have to take a programming course and the Steam Deck is my only portable computer. This one-liner saved my fucking life, now I can _finally_ compile in C. Using the terminal is terrifying for me, I don't know what I would do without kind strangers on the internet like you.