Where are toolchain binaries?

A newbie question - where is location of binaries used to compile sources during "make" phase?
I want to compile a singe c file using it for the platform I have built lede for...

In the SDK files on bottom of the same webpage you found the firmware. See: http://downloads.lede-project.org

Also see: https://wiki.openwrt.org/doc/howto/build for more resources. I found the information on that link helpful to compile a single C file for my device.

thanks, but I was more asking about where toolchain results locally during the build. I searched and found GCC inside staging directory...

That is correct. They are in the archive file as I noted. Everything needed to compile software can be found in the archive file. Have you read the manual?

but SDK doesn't contain all versions of GCC and binutils, so I wanted to build everything from scratch (for example GCC 7.3 was out 5 days ago :slight_smile: )

Then you need to compile from source.

1 Like

that what's i did. its just in the docs there is no description of the process how make does things, i.e. sources are fetched in dir aaa, then extracted into dir bbb, compile into dir ccc and then linked into ddd. Only final output is documented, so my original question was to those who know exactly where make put things... I obviously found them by now by spending half an hour searching through all the folders. Funny, it was supposed to save me 30 min, but we have probably discussed it for longer than that :slight_smile:

Incorrect, the manual says EXACTLY how make does these things.

BUT, I must apologize, the direct link to that information is here:

Add that directory to the PATH environment variable:

PATH=$PATH:(your toolchain/bin directory here)
export PATH

Set the STAGING_DIR environment variable to the above toolchain dir and export it:

STAGING_DIR=(your toolchain directory here)

Now, let's be clear, if you're looking for GCC v7.3:

  • I'm not sure of your concern about the version in the SDK, but it will compile software for your router
  • If you want to use a different GCC, as @robimarko noted, you will have to compile it from source and recreate the SDK.
  • (not suggested) If your router can hold GCC, you can build the C file on the router without Cross-Compiling
  • Or, you would use the manual, link the SDK to GCC and compile your software

Here is a script I use to compile software on an x64 Linux Machine (this file has some C++ in it and only compiled with g++). As you can see, I used the folder /home/user:

#sudo mkdir /build/lede-17.01/slaves/phase1/ar71xx_generic/build
#copy or symbolic link the staging_dir directory there
unset SED
export STAGING_DIR=/home/user/lede-sdk-17.01.1-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl-1.1.16
cd /home/user/program-1.0.0
mips-openwrt-linux-musl-g++ program.1.0.0.c -v -fpermissive -Wwrite-strings

The resulting a.out file excuted on my device once the package libstdcpp was installed.