Bug 916822 - ocaml-mysql programs do not compile
Summary: ocaml-mysql programs do not compile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ocaml-mysql
Version: 18
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-01 03:09 UTC by Sato Ichi
Modified: 2013-03-11 01:18 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-03-11 01:18:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Fixes the configure script in the ocaml-mysql source code. (517 bytes, patch)
2013-03-01 03:09 UTC, Sato Ichi
no flags Details | Diff

Description Sato Ichi 2013-03-01 03:09:19 UTC
Created attachment 704050 [details]
Fixes the configure script in the ocaml-mysql source code.

Description of problem: Programs that use the libraries in the ocaml-mysql package in F18 do not compile.


Version-Release number of selected component (if applicable): ocaml-mysql-1.1.1-1.fc18.x86_64 


How reproducible: Attempt to compile any OCaml program that uses objects in the Mysql module, get a compile-time error.


Steps to Reproduce:
1. Use yum to install the ocaml-mysql package.

2. Create a text file called mysqltest.ml consisting of the following code:

let dbh = Mysql.quick_connect ~host:"localhost" ~database:"test"
          ~user:"some_user" ~password:"my_password" ();;
Mysql.disconnect dbh;;
 
3. Attempt to compile the program:

ocamlopt -I /usr/lib64/ocaml/mysql -I /usr/lib64/mysql -o mysqltest \
mysql.cmxa mysqltest.ml

  
Actual results: The program fails to compile, showing the following errors:

/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `stmt_finalize':
(.text+0x23): undefined reference to `mysql_stmt_close'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `conn_finalize':
(.text+0xce): undefined reference to `mysql_close'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x2e4): undefined reference to `mysql_init'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x356): undefined reference to `mysql_options'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x40e): undefined reference to `mysql_real_connect'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x4c4): undefined reference to `mysql_options'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x4e9): undefined reference to `mysql_options'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x511): undefined reference to `mysql_options'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x545): undefined reference to `mysql_options'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x575): undefined reference to `mysql_options'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o):(.text+0x5a5): more undefined references to `mysql_options' follow
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_connect':
(.text+0x795): undefined reference to `mysql_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_change_user':
(.text+0x819): undefined reference to `mysql_change_user'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_change_user':
(.text+0x87b): undefined reference to `mysql_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_list_dbs':
(.text+0x95f): undefined reference to `mysql_list_dbs'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_list_dbs':
(.text+0x980): undefined reference to `mysql_num_rows'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_list_dbs':
(.text+0x9c0): undefined reference to `mysql_fetch_row'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_list_dbs':
(.text+0x9cd): undefined reference to `mysql_free_result'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_list_dbs':
(.text+0xa94): undefined reference to `mysql_free_result'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_select_db':
(.text+0xb59): undefined reference to `mysql_select_db'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_select_db':
(.text+0xbb1): undefined reference to `mysql_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_disconnect':
(.text+0xc33): undefined reference to `mysql_close'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_ping':
(.text+0xcf3): undefined reference to `mysql_ping'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_ping':
(.text+0xd3a): undefined reference to `mysql_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_exec':
(.text+0xe1e): undefined reference to `mysql_real_query'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_exec':
(.text+0xe5b): undefined reference to `mysql_store_result'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_exec':
(.text+0xeb4): undefined reference to `mysql_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fetch':
(.text+0xf77): undefined reference to `mysql_num_fields'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fetch':
(.text+0xf89): undefined reference to `mysql_fetch_row'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fetch':
(.text+0xf9f): undefined reference to `mysql_fetch_lengths'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_to_row':
(.text+0x10f4): undefined reference to `mysql_num_rows'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_to_row':
(.text+0x1104): undefined reference to `mysql_data_seek'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_status':
(.text+0x118e): undefined reference to `mysql_errno'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_errmsg':
(.text+0x1244): undefined reference to `mysql_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_escape':
(.text+0x135d): undefined reference to `mysql_escape_string'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_real_escape':
(.text+0x1497): undefined reference to `mysql_real_escape_string'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_set_charset':
(.text+0x15a9): undefined reference to `mysql_set_character_set'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_set_charset':
(.text+0x1601): undefined reference to `mysql_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_size':
(.text+0x166a): undefined reference to `mysql_num_rows'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_affected':
(.text+0x16c3): undefined reference to `mysql_affected_rows'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_insert_id':
(.text+0x1723): undefined reference to `mysql_insert_id'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fields':
(.text+0x1753): undefined reference to `mysql_num_fields'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_client_info':
(.text+0x17e1): undefined reference to `mysql_get_client_info'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_host_info':
(.text+0x1875): undefined reference to `mysql_get_host_info'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_server_info':
(.text+0x1905): undefined reference to `mysql_get_server_info'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_proto_info':
(.text+0x1929): undefined reference to `mysql_get_proto_info'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fetch_field':
(.text+0x1bca): undefined reference to `mysql_fetch_field'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fetch_field_dir':
(.text+0x1d6e): undefined reference to `mysql_fetch_field_direct'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fetch_fields':
(.text+0x1ee6): undefined reference to `mysql_num_fields'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `db_fetch_fields':
(.text+0x1f14): undefined reference to `mysql_fetch_fields'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_prepare':
(.text+0x20e7): undefined reference to `mysql_stmt_init'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_prepare':
(.text+0x2109): undefined reference to `mysql_stmt_prepare'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_prepare':
(.text+0x218b): undefined reference to `mysql_stmt_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_prepare':
(.text+0x2196): undefined reference to `mysql_stmt_close'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_close':
(.text+0x2247): undefined reference to `mysql_stmt_close'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `get_column':
(.text+0x245e): undefined reference to `mysql_stmt_fetch_column'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_execute':
(.text+0x26a4): undefined reference to `mysql_stmt_param_count'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_execute':
(.text+0x275d): undefined reference to `mysql_stmt_bind_param'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_execute':
(.text+0x2775): undefined reference to `mysql_stmt_execute'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_execute':
(.text+0x27d0): undefined reference to `mysql_stmt_field_count'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_execute':
(.text+0x2812): undefined reference to `mysql_stmt_bind_result'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_execute':
(.text+0x285b): undefined reference to `mysql_stmt_param_count'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_execute':
(.text+0x2896): undefined reference to `mysql_stmt_error'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_fetch':
(.text+0x29be): undefined reference to `mysql_stmt_fetch'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_affected':
(.text+0x2b52): undefined reference to `mysql_stmt_affected_rows'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_insert_id':
(.text+0x2be2): undefined reference to `mysql_stmt_insert_id'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_status':
(.text+0x2c72): undefined reference to `mysql_stmt_errno'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `caml_mysql_stmt_result_metadata':
(.text+0x2d57): undefined reference to `mysql_stmt_result_metadata'
/usr/lib64/ocaml/mysql/libmysql_stubs.a(mysql_stubs.o): In function `res_finalize':
(.text+0x5a): undefined reference to `mysql_free_result'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking


Expected results: The program should compile cleanly with no errors.


Additional info: The problem is that the /usr/lib64/ocaml/stublibs/dllmysql_stubs.so library that comes with the ocaml-mysql-1.1.1-1 package is not linked against the libmysqlclient.so library from the mysql-devel package.

The cause of the problem is that the configure script for building the ocaml-mysql libraries is looking for the static libmysqlclient.a library, which no longer exists in any current Fedora package. Also, on 64-bit systems the configure script does not search /usr/lib64/mysql for libraries.

I created a simple patch (attached as ocaml-mysql.patch) that fixes the problem.
The patch makes two modifications to the configure script:

1. The reference to libmysqlclient.a is replaced with libmysqlclient.so. This
means that the mysql-devel package will be required to build ocaml-mysql. The ocaml-camlp4-devel will also be required for the build.

2. The reference to /sw/lib/mysql is replaced with /usr/lib64/mysql. This should be OK since /sw/lib is never used in Fedora.

The patch can be applied like this in the directory above the ocaml-mysql-1.1.1
source directory:

patch -p0 < ocaml-mysql.patch

After applying the patch then building and installing the package, the problem goes away and the Mysql module can be used in OCaml programs.

Other systems that no longer have a static libmysqlclient.a library or that use /usr/lib64 might need this fix as well. For example, I have confirmed that the same problem affects Fedora 17, which uses the older ocaml-mysql-1.1.0 package.

Comment 1 Fedora Update System 2013-03-01 14:46:59 UTC
ocaml-mysql-1.1.1-3.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/ocaml-mysql-1.1.1-3.fc18

Comment 2 Fedora Update System 2013-03-02 20:10:36 UTC
Package ocaml-mysql-1.1.1-3.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ocaml-mysql-1.1.1-3.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-3283/ocaml-mysql-1.1.1-3.fc18
then log in and leave karma (feedback).

Comment 3 Sato Ichi 2013-03-09 21:42:33 UTC
I just tested the updates, they both work. Thanks a lot for the quick update!

Comment 4 Fedora Update System 2013-03-11 01:18:49 UTC
ocaml-mysql-1.1.1-3.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.