Skip to end of metadata
Go to start of metadata

Previously, we discussed how to add the basic APRE library in the "How to make a basic Makefile" chapter. This chapter describes the library and compile options that should be additionally described in Makefile, which in the SUN (Solaris) cc compiler is used.

Library and Compile Options for APRE compile in SUN (Solaris) environment.

Library to be added to Makefile

As previously mentioned, the basic APRE library "-lapre -lodbccli" must be described in Makefile.

When compiling with only the basic library added, there are system libraries referenced by the APRE library and a reference error occurs. Therefore, system libraries used in APRE must be specified in Makefile as follows.

Library typeMakefile LibraryDescription
Thread Library+Makefile or -lthreadThread library for POSIX thread functions
Math related Library-lmLibrary for using math functions
Dynamic Linking Loader (DL) Library-ldlDynamically loaded (DL) Library
Networking Services Library-lnslLibrary for using Networking Services functions
Sockets Library-lsocketLibrary for using Sockets functions
C++ Library-lCrun -ldemangleWhen compiling using cc in Altibase version 5.3.3 or lower version, specify C++ library
Realtime Extensions Library to be added-lrt 

Compile options

It is necessary to specify the following options to improve performance and specify the compile bit type.


OptionOption displayDescription
Multithread program compile option-mtNeed to specify when creating a program in multi-thread
Instruction Set Architecture (ISA)-xarch=amd64When compiling 64bit program on AMD cpu (X86) platform
-xarch=sse2aWhen compiling 32bit program on AMD cpu (X86) platform
-xarch=v9When compiling 64bit program on SUN sparc cpu platform
-xarch=v8plusWhen compiling 32bit porgram on SUN sparc cpu platform
Performance option-fastOption for improving Runtime performance

By referring to the $ALTIBASE_HOME/install/ file and $ALTIBASE_HOME/sample/APRE/Makefile, it can be referred to the optimized compile and link options when compiling APRE.

Example of simple Makefile

The simplest Makefile that can compile APRE in SUN X86 cc environment is completed as follows. In addition, if there is an additional library referenced by the program, the library must additionally be described in Makefile. Depending on the platform type, the options for specifying the memory model (32bit/64bit) may vary, so refer to the compile option table described above and set it according to the platform type.

LIBS=-lapre -lodbccli -lthread -lposix4 -ldl -lkvm -lkstat -lsocket -lnsl -lgen -lC -lCrun -ldemangle -lm
LFLAGS= -fast -mt -xarch=amd64 -L/opt/SUNWspro/lib/amd64 -L/usr/lib/amd64

/altibase_home/bin/apre -t c


/opt/SUNWspro/bin/cc $(LFLAGS) -o connect1 connect1.c -I$(ALTI_INCLUDE) -L$(ALTI_LIBRARY) $(LIBS)


rm *.c *.o

Example of Makefile for 32bit compile

An example of APRE Makefile for SUN X86 cc specifying the 32bit compile option is as follows. Specify "-xarch=sse2a" as a compile coption, and specify the path where the 32bit APRE library is installed in the path referencing the Header file and library. In addition, APRE precompiler also specifeis the path to execute 32bit APRE.

LIBS=-lapre -lodbccli -lpthread -lrt -ldl -lkvm -lkstat -lsocket -lnsl -lgen -lm

LFLAGS= -fast -mt -xarch=sse2a -L/opt/SUNWspro/lib/amd64 -L/usr/lib/amd64

/alticlient32/bin/apre -t c


/opt/SUNWspro/bin/cc $(LFLAGS) -o connect1 connect1.c -I$(ALTI_INCLUDE) -L$(ALTI_LIBRARY) $(LIBS)


rm *.c *.o


  • No labels