gcc and clang

<< Click to Display Table of Contents >>

Navigation:  Compiler and linker options >

gcc and clang

SMILE for Unix-based and Unix-like systems (Linux, FreeBSD) is compiled with the gcc toolchain. SMILE for Apple operating systems (iOS and macOS) is compiled with Apple clang. In both cases, we compile public binaries with -O3 and -DNDEBUG.

To use SMILE you will need the following on your g++ or clang command line:

Specify directory containing libsmile.a using -L option: -L<smiledir>

Specify directory containing smile.h using -I (uppercase I) option: -I<smiledir>

Add libsmile.a to libraries used by your program with -l (lowercase L) option: -lsmile. Note that the ‘lib’ prefix and ‘.a’ suffix are implied.

Example:

We assume that SMILE’s headers and libraries are located in the subdirectory ‘smile’ and your source code is in one or more files with the .cpp extension.

g++ -DNDEBUG -O3 *.cpp -I./smile -L./smile -lsmile

This command compiles your program and then links it with libsmile.a. The output executable binary has the default filename a.out. Note that -lsmile should be placed after *.cpp due to the g++ toolchain linker behavior (linker searches command line parameters from left to right).

To use C++ 11 support in SMILE, add the -std=c++11 (or a C++ standard later than C++11) option. This is required for std::initializer_list arguments in methods like DSL_nodeDef::SetDefinition.

The archive (.tar.gz) with SMILE binaries includes the build.txt file, which contains the details of the build environment used to compile the library, including the version of the compiler. Please make sure you are using the library compatible with your compiler.