[ODBC-268] Does not build on any platform other than i386/amd64 Created: 2019-10-15  Updated: 2022-01-30

Status: Open
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.1.4
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Bernhard Schmidt Assignee: Lawrin Novitsky
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Debian Linux



 Description   

I recently packaged MariaDB Connector/ODBC for Debian, see https://tracker.debian.org/pkg/mariadb-connector-odbc . After uploading it turned out that it fails to build on any platform that is not amd64 (x86_64) or i386.

https://buildd.debian.org/status/package.php?p=mariadb-connector-odbc

It fails to build on any other platform with

-- Looking for floor
-- Looking for floor - not found
-- Looking for floor in m
-- Looking for floor in m - found
-- odbc_config is not found 
-- Found ODBC Driver Manager includes: /usr/include
CMake Error at CMakeLists.txt:237 (MESSAGE):
  Driver Manager was not found

There is a lot of debug output from CMake after that, but I think those all come from the libm tests that passed before. Looking at cmake/FindDM.cmake I think it can work on any other platform right now, because it i.e. hardcodes the library path to x86_64-linux-gnu on all 64bit platforms.



 Comments   
Comment by Lawrin Novitsky [ 2019-10-15 ]

Well, no, it does not. As I read it, libraries are looked (for 64bit build) in /usr/local /usr /usr/local/Cellar/libiodbc/3.52.12 /usr/lib/x86_64-linux-gnu
And if exists /usr/lib64/, then in this paths added suffixes "lib64" "x86_64-linux-gnu", and "lib" "x86_64-linux-gnu" otherwise. If set, also searched ${DM_LIB_DIR} ${DM_DIR} ENV DM_LIB_DIR ENV DM_DIR. They can be set in cmake parameters, or in environment.

What's wrong/missing there?

And btw I don't think we support all those architectures in your build results table.

Comment by Jose Riha [ 2020-01-13 ]

thank you for the hint. this helped me to get the connector compiled on debian on arm:

DM_DIR=/usr/lib/arm-linux-gnueabihf cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DCMAKE_C_FLAGS_RELWITHDEBINFO="-I/usr/local/include/mariadb -I/usr/include/mariadb -L/usr/local/lib"

Comment by mocart [ 2020-10-05 ]

Hi! Can you help me please, with building mariadb-connector-odbc on armbian for orange pi, a have some problems:

Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

I try repeat like says Jose Riha:

DM_DIR=/usr/lib/arm-linux-gnueabihf 
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DCONC_WITH_MSI=OFF -DCMAKE_C_FLAGS_RELWITHDEBINFO="-I /usr/local/include/mariadb -I /usr/include/mariadb -L /usr/local/lib"

then i have that message:

CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.
 
 
-- Libraries installation dir: lib
-- Authentication Plugins installation dir: lib/mariadb/plugin
-- Configuring to build without SSL support
-- Running C/C cmake scripts
== Configuring MariaDB Connector/C
-- odbc_config is not found 
-- Found ODBC Driver Manager includes: /usr/include
CMake Error at CMakeLists.txt:248 (MESSAGE):
  Driver Manager was not found
 
 
-- Configuring incomplete, errors occurred!
See also "/usr/src/mariadb-connector-odbc/CMakeFiles/CMakeOutput.log".
See also "/usr/src/mariadb-connector-odbc/CMakeFiles/CMakeError.log".

Comment by Lawrin Novitsky [ 2020-10-07 ]

First, it's not really officially supported. But looks like it shouldn't be a problem to build. "Driver Manager was not found" means that either libraries or headers are not found. You can hint cmake where to look for them using DM_LIB_DIR and DM_INCLUDE_DIR cmake/env variables. You can also set ODBC_LIB_DIR and ODBC_INCLUDE_DIR variables directly(via cmake command line parameters). In this case cmake take these values won't even look for odbc_config, libraries and headers. But if required files are not there, then you get the error later during the build.

Comment by Bernhard Schmidt [ 2022-01-28 ]

I had another look at this lately, sorry for the delay.

3.1.15 builds fine on 32 bit architectures (see https://buildd.debian.org/status/package.php?p=mariadb-connector-odbc). I think this is due to the addition of /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} to the library search path on 32 bit architectures in

https://github.com/mariadb-corporation/mariadb-connector-odbc/commit/8f874259e3f9e8cfc539665b41fabeda75e1163a#diff-c141fe718a250390e467ab7007e8c81fbc4a30987dce2d59ba25e3d2100a6ad1

However, this is not done for 64 bit architectures, so it still fails.

We have a patch pending in the Debian BTS that replaces the whole code with pkg-config. It appears to work fine and is substantially cleaner, but needs pkg-config. If this is acceptable, I have opened a merge request with this code, see https://github.com/mariadb-corporation/mariadb-connector-odbc/pull/54 .

Note that I am not the author of the patch!

Comment by Lawrin Novitsky [ 2022-01-30 ]

I've pushed in the last commit also change for ${CMAKE_LIBRARY_ARCHITECTURE} is added to searched suffixes on all architectures. That may probably help.

Generated at Thu Feb 08 03:27:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.