configure.ac: check for Oracle libs is broken

Issue #42 closed
Vojtěch Hauser created an issue

The check reported as “checking for Oracle OCI libraries in $oracle_lib_dir...” sets

oci_ldflags="-L$oracle_lib_dir -lclntsh"
LDFLAGS="$LDFLAGS $oci_ldflags"

which on my machine produces gcc -o conftest <-W flags> -I<oracle include> -L<oracle lib> -lclntsh conftest.c -lpthread . Note that -lclntsh precedes conftest.c and thus the check inevitably fails with

/usr/bin/ld: /tmp/cc12Szfy.o: in function `main':
conftest.c:(.text.startup+0x23): undefined reference to `OCIEnvCreate'
/usr/bin/ld: conftest.c:(.text.startup+0x39): undefined reference to `OCIHandleFree'
collect2: error: ld returned 1 exit status

I am not sure if this is the proper way but this can be easily fixed by moving the -lcntsh to LIBS, i.e.

oci_ldflags="-L$oracle_lib_dir"
LIBS="-lclntsh"
LDFLAGS="$LDFLAGS $oci_ldflags"

Comments (6)

  1. Tildeslash repo owner

    Use /configure --with-oci-include=/opt/oci/include --with-oci-lib=/opt/oci/lib instead. This should set LIBS as expected. The built-in ax_lib_oracle_oci.m4 module can be buggy on modern systems and should be removed or fixed.

  2. Vojtěch Hauser reporter

    Well, that's exactly how I did it and my issue is that it doesn't set it correctly. Compare the first code block showing the actual code of configure (packaged in the tar with 3.2.2 release or generated using the bootstrap script from this repo) with the last one with my quick fix which enabled me to build the thing at all.

  3. Vojtěch Hauser reporter

    It seems that I can’t submit pull requests anymore but the fix is the matter of adding that extra LIBS line in ax_lib_oracle_oci.m4 as done here (or disabling this check altogether as you’ve suggested).

  4. Log in to comment