You will want to ensure the default prefix
/usr/local is available to build tools. If you know what you are doing, you can change the prefix, but this here shall assume you do not, and the above prefix is used. These environment variables are used during build, so you may want to make them more permanent.
export PATH=/usr/local/bin:"$PATH" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:"$PKG_CONFIG_PATH" export LD_LIBRARY_PATH=/usr/local/lib:"$LD_LIBRARY_PATH"
Below choose one of the following
CFLAGS to use. To ensure your code is compiled with decent optimzations you should also set this up in your environment:
export CFLAGS="-O3 -ffast-math -march=native"
Note that if you wish to compile for older architectures than your current system, please look up the compiler documentation and replace
-march=native with something appropriate.
If you wish decently optimized code that is still debuggable (but that optimizations may still make a little hard to debug) you can do:
export CFLAGS="-O2 -ffast-math -march=native -g -ggdb3"
If you want a really debuggable piece of code where optimizations mess with little to nothing at all use:
export CFLAGS="-O -g -ffast-math -march=native -ggdb3"
LD_LIBRARY_PATH environment variable is set. You can ensure the system always supports
/usr/local/lib by editing
/etc/ld.so.conf or adding a file to
/etc/ld.so.conf.d and simply have a line in either file that says:
And remember to run
sudo ldconfig tool every time you install a library to ensure caches are updated.