Showing posts with label compilation. Show all posts
Showing posts with label compilation. Show all posts

Wednesday, July 6, 2011

Machines in Mt-Laurel

rsh walter will say which machine to use.

gcc: Authorize for (int i)

gcc -std=gnu99

How to compile on odin

Create a view:

crtool  -rel sw9

Compile:

cd 
cc_mkmf
make

Use insure

make CC=insure

Open LDAP compilation (litchi)

First, install the sasl lib (not gsasl).
Second, configure options for Open LDAP:

LD_LIBRARY_PATH="/usr/local/lib/sasl2:/usr/local/BerkeleyDB.4.4/lib" LDFLAGS="-L/usr/local/lib/sasl2 -L/usr/local/BerkeleyDB.4.4/lib" CPPFLAGS="-I/usr/local/include/sasl -I/usr/local/BerkeleyDB.4.4/include " ./configure --enable-bdb --enable-ldbm --enable-ldap --enable-meta --enable-crypt --with-cyrus-sasl

Then, compile

make depend
make

Linux: Replace a dynamic library for a test

  • Re-compile the exe using the .so while removing the -rpath dir option.
  • export LD_LIBARY_PATH
  • Check with ldd on the exe that your library is taken into account.

Compile libapi.so sample

/u/engineering/locals/solaris9/softs/proglang/gcc-3.2/bin/gcc -m64 -fPIC -DULTICOM_IN_HOUSE_COMPILE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS   -DULTICOM_IN_HOUSE_COMPILE -I/vob/common/src -I/vob/signalware/../common/src   -I. -I.. -I/vob/common/3rdparty/licensemanager/include -I/vob/signalware//Master/Ft/inc -I/vob/signalware//Master/Ft/inc -I/vob/signalware//Master/cust_inc -I/vob/signalware//Master/cust_inc -I/vob/signalware//Master/priv_inc -I/vob/signalware//Master/priv_inc  -I/usr/X/include     -g -Wall -std=gnu99 -O  -I/vob/common/src -c ~/tmp/cpptrial/api_main.c -o api_main.o
/u/engineering/locals/solaris9/softs/proglang/gcc-3.2/bin/gcc -R /usr/lib/sparcv9/omni -L/vob/signalware/Master/library -L/vob/signalware/Master/library -m64 -R/usr/lib/sparcv9/omni  -o api_main  api_main.o -L/vob/common/lib/ -lulcmtoolsc  -lapi -ldf -lFt -lsocket -lnsl -lgen -lpthread -ldgms -lrt

man swmake

crtool man make

pm.c:7355: warning: int format, different type arg (arg 8)

This warning in 9V4 (but not in 9S50) is due to the fact that in Ft Proto.h, we have:

#ifdef GNUC
int FtFormatInternationalMsg (nl_catd catd, int set_number,
                              int message_number, _TCHAR defaultString,
                              _TCHAR destMsgBuf, int sizeDestMsgBuf, ...)
    attribute((format(printf, 4, 7)));

Explanation:

attribute format

This attribute allows assigning printf-like or scanf-like characteristics to the declared function, and this enables the compiler to check the format string against the parameters provided throughout the code. This is exceptionally helpful in tracking down hard-to-find bugs.

There are two flavors:

  • attribute((format(printf,m,n)))
  • attribute((format(scanf,m,n)))

but in practice we use the first one much more often.

The (m) is the number of the “format string” parameter, and (n) is the number of the first variadic parameter. To see some examples:

/* like printf() but to standard error only */
 extern void eprintf(const char *format, ...)
     __attribute__((format(printf, 1, 2)));  /* 1=format 2=params */

 /* printf only if debugging is at the desired level */
 extern void dprintf(int dlevel, const char *format, ...)
     __attribute__((format(printf, 2, 3)));  /* 2=format 3=params */

With the functions so declared, the compiler will examine the argument lists

$ cat test.c
 1  extern void eprintf(const char *format, ...)
 2               __attribute__((format(printf, 1, 2)));
 3
 4  void foo()
 5  {
 6      eprintf("s=%s\n", 5);             /* error on this line */
 7
 8      eprintf("n=%d,%d,%d\n", 1, 2);    /* error on this line */
 9  }
 $ cc -Wall -c test.c
 test.c: In function `foo':
 test.c:6: warning: format argument is not a pointer (arg 2)
 test.c:8: warning: too few arguments for format

Note that the “standard” library functions – printf and the like – are already understood by the compiler by default.

C7 compilation only

cd c7;swmake "PROT_FLAGS=-DC7_Q"

A7 compilation only

cd a7;swmake "PROT_FLAGS=-DA7_T"

CH7 compilation only

cd ch7;swmake "PROT_FLAGS=-DC7_Q -DCH7_Q"

J7 compilation only

cd j7;swmake "PROT_FLAGS=-DJ7_Q -DJ7G_Q"

Basic Signalware compilation

Compiles what is in ”/ccase/cm/crtool/var/swmake_filters/basic.filter”

swmake -Xfilter=basic

k2632 native sctp compilation

To compile /vob/signalware/Master/sctp/native, you first need to specify you use native SCTP via configurePlarform, then swcommission.

Typical error:

snmp_bindx undefined symbol

libexpat / libcrypto compilation

E.g. libcrypto compilation



> cd /vob/common/3rtparty/openssl
> swmake
Creating /vob/common/3rdparty/openssl/Makefile from /vob/common/3rdparty/openssl/Imakefile
current vob=/vob/common
imake default opts=-DPROD_sun -DUSE64BITS -DUSEGCC -DPROD_sol10 -DUSEGNUSYNTAX -DWINKIN_COMPILE -DREMOTE_SITE -DWINKIN_COMPILE
/vob/common/3rdparty/openssl (Imakefile)
reset imake add opts=-D_CURRENTVOB=/vob/common -I/vob/common/config
"./Imakefile", line 1: Can't find include file omni.cf
"./Imakefile", line 2: Can't find include file c++.cf
imake: Exit code 2. Stop.
Interupted: 256 at /vob/common/src/perl/Ulcm/Nmkmf.pm line 265.
clearmake: Error: Syntax error in file "Makefile", line 28, column 0
syntax error

To fix this shit, proceed as follows:

> nmkmf "-I/vob/signalware/Master/config" 
> swmake

ftxtract looks for ftxtract.cf

> OMNI_HOME=/vob/signalware ftxtract

Compile JMML utests

> cd jmml/utests
> /vob/common/3rdparty/jakarta-ant/jakarta-ant-1.5.4/bin/ant -DCOMMON_CMROOT=/vob/common