1. First extract the library
2. Read Readme or Install file comes with library.
you could specify your g++, gcc, ranlib, ar, strip through the configure command like this
You must be careful in console output after configure command execution below some important point focused
root@user-vm2:/home/user/ Desktop/AnyConnect/Raspberry( ARM_V7)_Environment/3rd_Party_ Cavium/expat-2.1.1# ./configure --host=aarch64 --enable-shared
checking build system type... x86_64-unknown-linux-gnu
checking host system type... aarch64-unknown-none
checking how to print strings... printf
checking for aarch64-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
You can see that your running system is x86_64-unknown-linux-gnu and your host/targeted/cross compile system is aarch64-unknown-none
We must follow the CPU-COMPANY-SYSTEM triplet convention to determine host name.
This gives you a bit more information because your host is aarch64-unknown-none where none is not acceptable
so we must give a valid or correct or exact host name by --host= parameter in configure command.
Now the question is where we could find the exact host name what we desired
We can define our tool chain path using ./configure command
env CPPFLAGS="-I/usr/local/bdb/include -I/usr/local/ssl/include" LDFLAGS="-L/usr/local/bdb/lib -L/usr/local/ssl/lib" ./configure --with-crypt --with-bdb --with-tls
2. Read Readme or Install file comes with library.
3. If its contain Config, config or configure or Configure file then first execute the -h or --help command to see the options that library provide to configure the this library before make. Like --host= option where you could tell for which architecture you are willing to compile this library( This called cross compilation). when you compile a library for another different architecture which is different than your current build environment. Like from ubuntu 64 bit Desktop i could make library for ARM architecture.
you could specify your g++, gcc, ranlib, ar, strip through the configure command like this
./configure --host=arm --enable-shared CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ AR=arm-none-linux-gnueabi-ar RANLIB=arm-none-linux-gnueabi-ranlib STRIP=arm-none-linux-gnueabi-strip
You must be careful in console output after configure command execution below some important point focused
root@user-vm2:/home/user/
checking build system type... x86_64-unknown-linux-gnu
checking host system type... aarch64-unknown-none
checking how to print strings... printf
checking for aarch64-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
You can see that your running system is x86_64-unknown-linux-gnu and your host/targeted/cross compile system is aarch64-unknown-none
We must follow the CPU-COMPANY-SYSTEM triplet convention to determine host name.
This gives you a bit more information because your host is aarch64-unknown-none where none is not acceptable
so we must give a valid or correct or exact host name by --host= parameter in configure command.
Now the question is where we could find the exact host name what we desired
There is documentation for target triplets. Theconfig.subfile that comes with the tarball is the "definitive" list for that tarball (until it's packaged with a later version of autotools). The most helpful information will come from how the compiler prefix (and other binutils) are named (in this examplearm-none-linux-gnueabi-) collected from Stack Overflow
We can define our tool chain path using ./configure command
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
env CPPFLAGS="-I/usr/local/bdb/include -I/usr/local/ssl/include" LDFLAGS="-L/usr/local/bdb/lib -L/usr/local/ssl/lib" ./configure --with-crypt --with-bdb --with-tls