This article was originally posted in my csdn.net blog on 19 Mar 2009.
Download unixODBC-2.2.14.tar.gz from http://www.unixodbc.org/ first.
According to introduction in the document of http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0402walker/index.html, we can get the installation directory by using gzip -d and tar xvf.
Then issue the following command:
./configure --prefix=/home/unixodbc --disable-gui --disable-drivers CC=xlc_r CXX=xlC_r
But when I issued the command, an error stating xlc not found occured. By checking the PATH environment variable, I found the directory vacpp is missing because we didn't add this path in PATH environment variable for the root user.
Modified /etc/environment to add /usr/vacpp/bin into PATH environment variable and re-issued the above command. It's ok this time.
After the configure process finished, I checked the config.log and found some information like:
configure:23014: checking if platform is 64 bit
configure:23017: result: No
It seemed the installation program considered the platform is 32 bit. That must be for the reason we didn't set the OBJECT_MODE environment variable to 64 bit. So issued the command export OBJECT_MODE=64 and then start the configure process again. It's also ok now.
The second step was to make. It took a little bit time to make. The process in the beginning was very well, but the following error occurred when making the file SQLGetPrivateProfileString.c in the directory odbcinst:
source='SQLGetPrivateProfileString.c' object='SQLGetPrivateProfileString.lo' libtool=yes DEPDIR=.deps depmode=none /bin/sh ../depcomp /bin/sh ../libtool --tag=CC --mode=compile xlc_r -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"unixODBC\" -DVERSION=\"2.2.14\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SEM_H=1 -DHAVE_DLFCN_H=1 -DHAVE_ICONV=1 -DICONV_CONST= -DHAVE_LIBCRYPT=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TIME_H=1 -DSIZEOF_LONG=8 -DPLATFORM64=1 -DHAVE_LONG_LONG=1 -DSIZEOF_LONG_INT=8 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 -DHAVE_VSNPRINTF=1 -DHAVE_STRTOL=1 -DHAVE_ATOLL=1 -DHAVE_STRTOLL=1 -DHAVE_ENDPWENT=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_FTIME=1 -DHAVE_TIME=1 -DHAVE_LIBTHREAD=1 -D_REENTRANT=1 -DHAVE_LOCALTIME_R=1 -DHAVE_FTOK=1 -DHAVE_SEMGET=1 -DHAVE_SHMGET=1 -DHAVE_SEMOP=1 -DHAVE_SNPRINTF=1 -DNEED_SEMUNDO_UNION=1 -DCOLLECT_STATS=1 -DSTDC_HEADERS=1 -DHAVE_MALLOC_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PWD_H=1 -DHAVE_CRYPT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYNCH_H=1 -DHAVE_STRINGS_H=1 -DHAVE_STRING_H=1 -DHAVE_LOCALE_H=1 -DHAVE_SYS_MALLOC_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_SEM_H=1 -DHAVE_STDARG_H=1 -DHAVE_VARARGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMEB_H=1 -DHAVE_TIME_H=1 -DHAVE_DIRENT_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_VPRINTF=1 -DHAVE_DOPRNT=1 -DHAVE_PUTENV=1 -DHAVE_SOCKET=1 -DHAVE_STRDUP=1 -DHAVE_STRSTR=1 -DHAVE_SETENV=1 -DHAVE_SETLOCALE=1 -DHAVE_STRCHR=1 -DUNIXODBC_SOURCE=1 -I. -I. -I../include -DSYSTEM_FILE_PATH=\"/ztebsn/unixodbc/etc\" -DDEFLIB_PATH=\"/ztebsn/unixodbc/lib\" -DSHLIBEXT=\".so\" -DUNIXODBC_SOURCE -I../libltdl -g -DENABLE_INI_CACHING -c -o SQLGetPrivateProfileString.lo SQLGetPrivateProfileString.c
xlc_r -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"unixODBC\" -DVERSION=\"2.2.14\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SEM_H=1 -DHAVE_DLFCN_H=1 -DHAVE_ICONV=1 -DICONV_CONST= -DHAVE_LIBCRYPT=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TIME_H=1 -DSIZEOF_LONG=8 -DPLATFORM64=1 -DHAVE_LONG_LONG=1 -DSIZEOF_LONG_INT=8 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 -DHAVE_VSNPRINTF=1 -DHAVE_STRTOL=1 -DHAVE_ATOLL=1 -DHAVE_STRTOLL=1 -DHAVE_ENDPWENT=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_FTIME=1 -DHAVE_TIME=1 -DHAVE_LIBTHREAD=1 -D_REENTRANT=1 -DHAVE_LOCALTIME_R=1 -DHAVE_FTOK=1 -DHAVE_SEMGET=1 -DHAVE_SHMGET=1 -DHAVE_SEMOP=1 -DHAVE_SNPRINTF=1 -DNEED_SEMUNDO_UNION=1 -DCOLLECT_STATS=1 -DSTDC_HEADERS=1 -DHAVE_MALLOC_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PWD_H=1 -DHAVE_CRYPT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYNCH_H=1 -DHAVE_STRINGS_H=1 -DHAVE_STRING_H=1 -DHAVE_LOCALE_H=1 -DHAVE_SYS_MALLOC_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_SEM_H=1 -DHAVE_STDARG_H=1 -DHAVE_VARARGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMEB_H=1 -DHAVE_TIME_H=1 -DHAVE_DIRENT_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_VPRINTF=1 -DHAVE_DOPRNT=1 -DHAVE_PUTENV=1 -DHAVE_SOCKET=1 -DHAVE_STRDUP=1 -DHAVE_STRSTR=1 -DHAVE_SETENV=1 -DHAVE_SETLOCALE=1 -DHAVE_STRCHR=1 -DUNIXODBC_SOURCE=1 -I. -I. -I../include -DSYSTEM_FILE_PATH=\"/ztebsn/unixodbc/etc\" -DDEFLIB_PATH=\"/ztebsn/unixodbc/lib\" -DSHLIBEXT=\".so\" -DUNIXODBC_SOURCE -I../libltdl -g -DENABLE_INI_CACHING -c SQLGetPrivateProfileString.c -o SQLGetPrivateProfileString.o
"SQLGetPrivateProfileString.c", line 66.8: 1506-166 (S) Definition of function mutex_t requires parentheses.
"SQLGetPrivateProfileString.c", line 66.16: 1506-276 (S) Syntax error: possible missing '{'?
"SQLGetPrivateProfileString.c", line 70.24: 1506-045 (S) Undeclared identifier mutex.
"SQLGetPrivateProfileString.c", line 73.32: 1506-277 (S) Syntax error: possible missing ')' or ','?
"SQLGetPrivateProfileString.c", line 75.26: 1506-045 (S) Undeclared identifier mutex.
"SQLGetPrivateProfileString.c", line 261.23: 1506-045 (S) Undeclared identifier mutex_ini.
"SQLGetPrivateProfileString.c", line 281.23: 1506-045 (S) Undeclared identifier mutex_ini.
make: 1254-004 The error code from the last command is 1.
According to the error message, the complier can not find the definition of mutex_t. But it is defined in system header file /usr/include/synch.h, so this file sync.h should be directly or indirectly refered to by the file SQLGetPrivateProfileString.c.
Googled this error information I found some useful information in http://bbs.chinaunix.net/archiver/tid-1354992.html, this link presents a solution: copy $(SOURCEDIR)/DriverManager/drivermanager.h and __stats.h to the directory $(SOURCEDIR)/include. I did that but unfortunately it didn't work yet. The same error persisted.
After careful review for the file drivermanager.h, I found it does include synch.h if the pre-compile macro HAVE_SYNCH_H is defined and we can find -DHAVE_SYNCH_H=1 from the options in the compile command.
Then I checked SQLGetPrivateProfileString.c and found only two head files time.h and odbcinstext.h were included. I checked all the header files level by level but did not find synch.h or drivermanager.h. So I was convinced that the program should be modified so that the file synch.h can be refered to by file SQLGetPrivateProfileString.c. OK, let's do it.
Modify $(SOURCEDIR)/include/odbcinstext.h just like this:
add a new line
#include <drivermanager.h>
after the following line:
#include <odbcinst.h>
And then started to make again and no error occurred.
The last step was to install by issuing the command:
make install
Now the unixodbc is successfully installed.
No comments:
Post a Comment