0

I'm trying to compile Erlang on FreeBSD, and I want to include the odbc licenses.

On Ubuntu, if you add the unixodbc-dev package, that ensures that odbc gets compiled with Erlang, however, I can't find a package that works equivalently with FreeBSD.

I've tried installing the unixODBC package, and the libodbc++ with libiodbc packages. Neither of these work.

I've also tried download unixodbc from unixodbc.org and installing that, to no avail.

So if there's a package I can use, or if there's something I should download from source and compile, I've so far been unsuccessful in finding the solution.

Any ideas on what packages need to be installed or what steps need to be taken to ensure ODBC gets compiled with Erlang?

Note: this is with FreeBSD 9.1-Release, and Erlang R16B02

chops
  • 2,572
  • 1
  • 16
  • 25

2 Answers2

1

From looking at the package file list, unixODBC should be the correct package.

Look inside lib/odbc/config.log from where you compiled Erlang. Mine says (on Debian):

configure:4913: checking for odbc in standard locations
configure:4939: result: -L/usr/lib

The "standard locations" are /usr/local/odbc /usr/local /usr/odbc /usr /opt/local/pgm/odbc /usr/local/pgm/odbc, and the configure script looks for include/sql.h below one of those directories. If yours is installed in a different directory, try specifying --with-odbc=/some/path to the configure script.

legoscia
  • 39,593
  • 22
  • 116
  • 167
  • I gave this a few tries, and had no luck. sql.h is located in `usr/local/include/sql.h`, and in `/usr/local/lib` are a handful of odbc files (`libodbc.so`, `libodbccr.so`, etc). I've tried `--with-odbc=/usr/local`, `--with-odbc=/usr/local/lib`, `--with-odbc=/usr/local/include`, but every time I run `./configure` the result is that odbc is not found. Thank you for your insight, it definitely felt like it would yield something, but unfortunately, did not get my any closer to having FreeBSD compiled with odbc. – chops Oct 07 '13 at 15:59
0

Erlang can use unixODBC or libiodbc.

It should work when you install Erlang from ports. First, make sure your ports tree is up to date, e.g. with portsnap.

Login or su to root. Then go to /usr/ports/lang/erlang, and run make config. You should then see the following screen:

       ┌─────────────────────────── erlang-15.b.03.1_1,3 ─────────────────────────────┐              
       │ ┌──────────────────────────────────────────────────────────────────────────┐ │              
       │ │+[x] DOCS      Build and/or install documentation                         │ │              
       │ │+[ ] DTRACE    Enable DTrace support (experimental)                       │ │              
       │ │+[ ] GCC       Use current GCC                                            │ │              
       │ │+[ ] GS        Enable GS application (deprecated)                         │ │              
       │ │+[ ] HIPE      Build native HiPE compiler                                 │ │              
       │ │+[ ] JAVA      Java platform support                                      │ │              
       │ │+[x] KQUEUE    Enable Kernel Poll (kqueue) support                        │ │              
       │ │+[ ] ODBC      ODBC backend                                               │ │              
       │ │+[x] OPENSSL   SSL/TLS support via OpenSSL                                │ │              
       │ │+[x] SCTP      Enable SCTP support                                        │ │              
       │ │+[x] SMP       Enable SMP support                                         │ │              
       │ │+[x] THREADS   Threading support                                          │ │              
       │ │+[ ] WX        Enable WX application                                      │ │              
       │ │─────────────────────────────── ODBC backend ─────────────────────────────│ │              
       │ │+( ) IODBC     ODBC backend via iODBC                                     │ │              
       │ │+( ) UNIXODBC  ODBC backend via unixODBC                                  │ │              
       │ └──────────────────────────────────────────────────────────────────────────┘ │              
       ├──────────────────────────────────────────────────────────────────────────────┤              
       │                       <  OK  >            <Cancel>                           │              
       └──────────────────────────────────────────────────────────────────────────────┘              

Select either the IOBDC or the UNIXODBC option. Then run the command make install clean as root. That should build and install Erlang and all its dependencies.

Edit: if you don't want to use ports, make sure you have either databases/unixODBC or databases/libiodbc installed before compiling erlang, and then use the --with-odbc option with erlang's configure, it should work fine. That is what the port does.

Roland Smith
  • 42,427
  • 3
  • 64
  • 94
  • I wish I could use the ports, but I need to compile from source from erlang.org due to the fact that the Ports tree is lagging behind (in this case, 3 releases behind). But thank you. I appreciate the answer nonetheless. – chops Oct 07 '13 at 15:54
  • Thanks, I'm going through it now. I tried just adding unixODBC and then doing `gmake clean` then `./configure --with-odbc`, but the results still say `odbc` not found. I'm going to plunk around in ports for a bit and see what happens and get back to you. Thanks again for the followup. – chops Oct 07 '13 at 19:01
  • No luck. I've installed unixODBC from source, from the unix package (`pkg_add -r -v unixODBC`), and from ports (which seems to just get it from unixodbc.org). No matter what method I do, or what path I provide to `--with-odbc`, `./configure` always says "ODBC Library - Link check failed". The configure output says `checking for ODBC in standard locations -L/usr/local/lib`, followed by `checking for SQLAllocHandle in -lodbc... no`. And the ODBC files are in `/usr/local/lib` while the `sql.h` file is in `/usr/local/include/`. So I'm completely stumped. – chops Oct 07 '13 at 19:43
  • @chops: Check the configure output log to see *exactly* what fails. Have you tried running `ldconfig` after installing the libraries? Don't forget to start form a clean (newly unpacked) erlang directory as well after that. Sometimes results from previous configure runs persist. – Roland Smith Oct 07 '13 at 20:10