2

So I'm trying to build Erlang/OTP 18.3 on OS X 10.9 Mavericks, and seem to be running into a problem where odbc libraries/headers aren't being found.

The first time I tried running configure I got the message:

*********************************************************************
**********************  APPLICATIONS DISABLED  **********************
*********************************************************************

odbc           : ODBC library - header check failed

I went looking for any information I could find about ODBC libraries on OS X, and found an earlier question/answer which noted "Since OS X 10.9 (Mavericks) Apple stopped including the iODBC SQL header files", suggesting that might be the key issue.

So I grabbed libiodbc from iodbc.org, built the OS X version, and tried again:

odbc           : ODBC library - header check failed

Hmmm. OK, apparently building for OS X drops the libraries/headers into /Library/Frameworks by default. Maybe the configuration process for OTP doesn't know to look there? So I tried building libiodbc again, this time with --prefix=/usr/local. And:

odbc           : ODBC library - header check failed

I can verify that /usr/local/include contains iodbcext.h, iodbcunix.h, isqlext.h, sql.h, sqltypes.h, iodbcinst.h, isql.h, isqltypes.h, odbcinst.h, sqlext.h, sqlucode.h, so it definitely seems like the headers should be discoverable.

I looked around for any earlier discussion on the erlang-questions mailing list about odbc and builds, and found an old message which suggests there was a time when the configuration process didn't recognize iodbc searches on OS X... but quick check of lib/odbc/configure.in under the erlang source director seems to show a patch suggested in that message was folded in and this should no longer be an issue.

What am I missing? Is there another way to tell configure where it should be looking for libiodbc? Something else needed?

Failing that -- can I debug/alter the configuration process in some way?

Edit

At the suggestion of @legoscia, I peeked inside lib/odbc/config.log. There's a lot in there, so I'll link the full file rather than posting it, but there are two errors that seem relevant:

conftest.c:29:10: fatal error: 'sql.h' file not found
...
conftest.c:29:10: fatal error: 'sqlext.h' file not found

This is odd, because as I said earlier, I can verify that /usr/local/include contains these files. I'm using --with-odbc=/usr/local. And later in config.log, under the Output Variables header, it also specifies it knows ODBC_INCLUDE='-I/usr/local/include'. It seems to know where to look, and the files are in that location, but something doesn't see them.

Community
  • 1
  • 1
Weston C
  • 3,642
  • 2
  • 25
  • 31
  • How are you trying to build? Kerl works fine for me. – Nathaniel Waisbrot Aug 31 '16 at 03:15
  • 1
    What are the error messages in `lib/odbc/config.log`? – legoscia Aug 31 '16 at 09:04
  • 1
    You might try installing the [pre-compiled iODBC 3.52.12 for OS X](http://opldownload.s3.amazonaws.com/uda/components/7.0/universal-apple-macosx10.7-32/mxkozzzz.dmg), which brings you all the headers, full Frameworks for GUI support, full 64-bit and 32-bit support, etc., and puts everything where OS X expects to find them. (ObDisclaimer: [My employer](http://www.openlinksw.com/) maintains and supports [iODBC](http://www.iodbc.org/).) – TallTed Aug 31 '16 at 21:24
  • 1
    Better use a DMG from ErlangSolutions: https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_18.3-1~osx~10.10_amd64.dmg – Ruel Sep 05 '16 at 07:45
  • @legoscia - great suggestion, read the log, not a *lot* of new information, but I've updated my question accordingly. – Weston C Sep 11 '16 at 18:53

2 Answers2

1

Reading lib/odbc/configure.in, this seems like a bug. It looks like the check for sql.h and sqlext.h (on line 120) doesn't take the path specified in --with-odbc into account. I'd suggest reporting this over at https://bugs.erlang.org/.

legoscia
  • 39,593
  • 22
  • 116
  • 167
  • I'm trying to understand this well enough to file a bug report; I think I do see a check for that path down on [lines 150-158](https://github.com/erlang/otp/blob/OTP-19.0/lib/odbc/configure.in#L150)? But I don't know what it means that this is after the lines you referenced. And I'm also wondering if there's a way to inspect the values of `$host_os` and `$with_odbc` (I tried adding `echo >&1 "blerg: $with_odbc"` to configure.in, but that doesn't seem to produce anything). – Weston C Sep 22 '16 at 20:22
  • Yes, those lines set the include path according to the setting - but that happens after the variable `odbc_required_headers` has been set to `no`, which forces the configure to fail. After changing `configure.in`, did you run `./otp_build autoconf` in the top-level directory? – legoscia Sep 23 '16 at 07:30
1

After studying the problem for a while in pursuit of trying to ask better questions or create a good bug report for the Erlang maintainers... I've discovered this is not a problem with the Erlang source distribution at all, but rather an issue where by default clang doesn't search /usr and /usr/local. Awesome, right?

The fix for this is to run xcode-select --install (see the SO question "On mac, g++ (clang) fails to search /usr/local/include and /usr/local/lib by default").

Also, if you need to take a look and try to figure out what search paths clang is using, you can invoke:

  • clang -x c -v -E /dev/null to get include paths
  • clang -Xlinker -v to get linker paths

(From a blog post: "OS X clang include lib search path.")

Community
  • 1
  • 1
Weston C
  • 3,642
  • 2
  • 25
  • 31