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 acc (C compiler) is used in HP UX environment.

Additional libraries and compile options for APRE compile in HP UX environment

Libraries 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
Posix thread Library-lpthreadThread library for POSIX thread functions

Math related Library

-lmLibrary for using math functions
Dynamic Linking Loader(DL Library)-ldldDynamic loaded (DL) library
Unwind Express Library-lunwindLibrary for use of API for stack tracking and stack winding in Itanium-based server
C++ Library-lstd –lstream –lCsup -lcIn case of compiling using acc C compiler in Altibase version 5.3.3 or earlier version, specify C++ library
Realtime Extension Library to be added  

 

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-mtDesignation required when creating a program with multi-thread
Instruction Set Architecture (ISA) Designation+DD64Creating 64-bit code for HP-UX on IA64
+DD32Creating 32-bit code for HP-UX on IA64
Warning option+vnocompatwarningsOption to reduce unnecessary warning messages
Icon

By referring to the $ALTIBASE_HOME/install/altibase_env.mk 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 HP acc environment is completed as follows. In addition, if there is an additional library referenced by the program, the library must be additionally described in Makefile.

ALTI_INCLUDE=$(ALTIBASE_HOME)/include
ALTI_LIBRARY=$(ALTIBASE_HOME)/lib
LIBS=-lapre -lodbccli -lpthread -lunwind -lm
LFLAGS= -mt +DD64 -Wl,+vnocompatwarnings -L.

connect1.c:connect1.sc

$(ALTIBASE_HOME)/bin/apre -t c connect1.sc

connect1:connect1.c

cc $(LFLAGS) -o connect1 connect1.c -I$(ALTI_INCLUDE) -L$(ALTI_LIBRARY) $(LIBS)

clean:

rm *.c *.o

Example of Makefile for 32bit compile

An example of the APRE Makefile for acc that specifies the 32bit compile option is as follows. Specify "+DD32" as a compile option, and specify the path where the 32bit APRE library is installed in the path referencing the header file and library. In addition, the APRE precompiler also specifies the path to execute 32bit APRE.

ALTI_INCLUDE=/alticlient32/include
ALTI_LIBRARY=/alticlient32/lib
LIBS=-lapre -lodbccli -lpthread -lunwind -lm
LFLAGS= -mt +DD32 -Wl,+vnocompatwarnings -L.

connect1.c:connect1.sc

/alticlient32/bin/apre -t c connect1.sc

connect1:connect1.c

cc $(LFLAGS) -o connect1 connect1.c -I$(ALTI_INCLUDE) -L$(ALTI_LIBRARY) $(LIBS)

clean:

rm *.c *.o

  • No labels