Oracle compilation

alexandre.chapellon at mana.pf alexandre.chapellon at mana.pf
Sun Dec 12 05:43:42 CET 2010


Unless I missunderstood the compil process it seems to me that todays source tree is stuck to Oracle 10g. Indeed the configure.in file for the rlm_sql_oracle module has a library name harcoded: libnnz10.
If you run Oracle instantclient 11g (I guess it's the same with a full installation of Oracle 11g) the library is named libnnz11. As a result, oracle linking test wiil always fail even with a correct --with-oracle-lib-dir set.
To be able to compile with both version of Oracle (10g and 11g)
I suggest a new option can be set that would define the version during ./configure.
If it sounds ok for everyone and can be tested by more people (I only tested it on Debian with instantclient_11.1), here is "works for me" patch that introduce the --with-oracle-version switch.

--- freeradius-server-2.1.10.orig/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.in	2010-09-28 11:03:56.000000000 +0000
+++ freeradius-server-2.1.10/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.in	2010-12-12 03:58:02.000000000 +0000
@@ -22,6 +22,23 @@
 	dnl # Check for command line options
 	dnl ############################################################
 
+	dnl extra argument: --with-oracle-version=VER
+	oracle_version=
+	AC_ARG_WITH(oracle-version,
+		[AS_HELP_STRING([--with-oracle-version=VER],
+			[Version of Oracle to search for. Should be 10 for Oracle 10g and 11 for 11g])],
+		[case "$withval" in
+                        11)
+                            oracle_version="$withval"
+                            ;;
+                        10)
+                            oracle_version="$withval"
+                            ;;
+                        *)
+                           AC_MSG_ERROR(Need oracle-version)
+                            ;;
+                esac])
+
 	dnl extra argument: --with-oracle-include-dir=DIR
 	oracle_include_dir=
 	AC_ARG_WITH(oracle-include-dir,
@@ -86,7 +103,12 @@
 		if test "x$oracle_lib_dir" != "x" ; then
 			ORACLE_LIBDIR_SWITCH="-L${oracle_lib_dir} "
 		fi
-		LIBS="$old_LIBS $ORACLE_LIBDIR_SWITCH -lclntsh -lnnz10"
+                if test "x$oracle_version" = "x" ; then
+                        AC_MSG_RESULT(no)
+                        AC_MSG_WARN([oracle version not found.  Use --with-oracle-version={10|11}.])
+                        fail="$fail Oracle version"
+                else 
+		LIBS="$old_LIBS $ORACLE_LIBDIR_SWITCH -lclntsh -lnnz${oracle_version}"
 		AC_TRY_LINK([#include <oci.h>
 	
 				static OCIEnv           *p_env;
@@ -109,12 +131,13 @@
 				          (void (*)(dvoid *, dvoid *)) 0 );
 
 			],
-			ORACLE_LIBS="$ORACLE_LIBDIR_SWITCH -lclntsh -lnnz10",
+			ORACLE_LIBS="$ORACLE_LIBDIR_SWITCH -lclntsh -lnnz${oracle_version}",
 			ORACLE_LIBS=
 		)
 
 		LIBS="$old_LIBS"
 		CFLAGS="$old_CFLAGS"
+                fi
 	fi
 
 
@@ -129,7 +152,7 @@
 
 		if test "x$ORACLE_LIBS" = "x"; then
 			AC_MSG_WARN([oracle libraries not found.  Use --with-oracle-lib-dir=<path>.])
-			fail="$fail libclntsh libnnz10"
+			fail="$fail libclntsh libnnz${oracle_version}"
 		else
 			sql_oracle_ldflags="${sql_oracle_ldflags} $ORACLE_LIBS"
 			AC_MSG_RESULT(yes)


As you can see the patch modify the configure.in file autogen.sh must be used after patching.

P.S The patch do not include version of Oracle prior to 10 because the instantclient archive is not available anymore on the Oracle website.



More information about the Freeradius-Users mailing list