aseprite / skia

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.
https://skia.org
BSD 3-Clause "New" or "Revised" License
170 stars 42 forks source link

command not found: gn #11

Open chrisgauthier9 opened 3 years ago

chrisgauthier9 commented 3 years ago

I've been trying to compile ### skia on my Mac running Catalina 10.15.7.

I've gotten to the step: $ gn gen out/Release-x64 --args="is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_sfntly=false skia_use_freetype=true skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_freetype2=false skia_use_system_harfbuzz=false target_cpu=\"x64\" extra_cflags=[\"-stdlib=libc++\", \"-mmacosx-version-min=10.9\"] extra_cflags_cc=[\"-frtti\"]"

But I've been getting the following error: $ command not found: gn

Any ideas??

ralgernon commented 3 years ago

A Bit of Background

GN is what generates the build files for Ninja. In the terminal, we've been typing or pasting in commands to run different executable files which the shell of our operating system then reads and executes. Our operating system has a variable called $PATH where it keeps a list of directories of all these files, separated by a colon. This resets every time your computer restarts or there's a new terminal instance.

Where to Look

When curious about what that list looks like, I like to use the echo command in the terminal like so: echo $PATH

We'll see something like /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, which are the usual suspects for where to find commands. We edit this using export. In the Aseprite Mac OS instructions, we used: export PATH="${PWD}/depot_tools:${PATH}"

Which can be translated to:

"Dear shell, Please check the directories in the $PATH variable list for a command called export. Execute that to include the depot_tools directory found in the present working directory (PWD, which directory this command is being called from) in my $PATH at the beginning. I want this directory searched first for commands until I close this terminal or restart my computer. Finally, put back all the directories that were in the $PATH list at the end, so you know where else to look if a command isn't found in depot_tools."

The Problem

Your shell has replied that it couldn't find gn in all the directories listed in $PATH, which should have included where the depot_tools was installed after running the above command from the /home/your_user_name/deps directory. When you run echo $PATH, before the first colon should be /home/your_user_name/deps/depot_tools with your actual user name substituted in, so your shell checks the first directory cloned with Git.

Troubleshoot

ls ~/deps/depot_tools/ | grep gn This command will ask your shell to print all files whose names contain "gn" inside the correct directory. If you get a gn in your response, move ahead to the PATH section. If nothing shows up, run: ls ~/deps | grep depot_tools to make sure depot_tools was installed in the right place. If nothing again, you might have missed the step to cd (change directories) to the newly made deps and installed depot_tools and skia to your home directory by accident. The following commands will copy them from home ("~") to the deps directory and delete the misplaced originals: cp -R ~/depot_tools deps && rm -rf ~/depot_tools cp -R ~/skia deps && rm -rf ~/skia

PATH to Success

Hopefully you are in the /home/your_user_name/deps/ directory. You can check with: pwd Run this command again: export PATH="${PWD}/depot_tools:${PATH}" and check again that the first entry matches /home/your_user_name/deps/depot_tools with: echo $PATH

I don't think it's important to clear out the wrong entries, they'll be gone after the terminal window is closed. The shell checks directories in the same order they are listed in the $PATH and when it finds what it wants.

Success!

You can now change directories back to the skia one with: cd skia Skip running the python script again, and try running the command that starts with gn again! If it worked, you'll see something like: Done. Made 60 targets from 44 files in 121ms

Hopefully this helps!

otoayana commented 3 years ago

I have the same issue on my musl libc install of Void Linux.