Bug 269256 - graphics/gdal: build fails with option MYSQL set
Summary: graphics/gdal: build fails with option MYSQL set
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-30 20:07 UTC by Martin Birgmeier
Modified: 2023-09-04 09:21 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2023-01-30 20:07:19 UTC
Scenario:
- FreeBSD 12.4
- ports latest
- upgrading using portmaster
- gdal port option settings:

[0]# diff =(PORT_DBDIR=/nonexistent make showconfig) =(make showconfig)       
10c10
<      EXR=off: EXR support via OpenEXR library
---
>      EXR=on: EXR support via OpenEXR library
13c13
<      GTA=off: Generic Tagged Array (GTA) support
---
>      GTA=on: Generic Tagged Array (GTA) support
20c20
<      MYSQL=off: MySQL database support
---
>      MYSQL=on: MySQL database support
22c22
<      ODBC=off: ODBC database backend
---
>      ODBC=on: ODBC database backend
[1]# 

Result:
- build of gdal-3.6.2 fails with:

...
-- GDAL_ABI_FULL_VERSION = 32.3.6.2
-- GDAL_SOVERSION        = 32
-- Found ODBC: /usr/local/lib/libodbc.so  found components: ODBCINST
-- Could NOT find ODBCCPP (missing: ODBCCPP_LIBRARY ODBCCPP_INCLUDE_DIR)
-- Could NOT find MSSQL_ODBC (missing: MSSQL_ODBC_LIBRARY MSSQL_ODBC_INCLUDE_DIR MSSQL_ODBC_VERSION)
-- Could NOT find MySQL (missing: MYSQL_LIBRARY) (found version "5.7.40")
CMake Error at cmake/helpers/CheckDependentLibraries.cmake:178 (message):
  Configured to use MYSQL, but not found
Call Stack (most recent call first):
  cmake/helpers/CheckDependentLibraries.cmake:260 (gdal_check_package)
  gdal.cmake:264 (include)
  CMakeLists.txt:224 (include)


-- Configuring incomplete, errors occurred!
See also "/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/graphics/gdal/work/.build/CMakeFiles/CMakeOutput.log".
See also "/usr/tmp/net/hal/z/SRC/FreeBSD/ports/MBi/main/graphics/gdal/work/.build/CMakeFiles/CMakeError.log".
*** Error code 1

Stop.
make[1]: stopped in /net/hal/z/SRC/FreeBSD/ports/MBi/main/graphics/gdal
*** Error code 1

Stop.
make: stopped in /net/hal/z/SRC/FreeBSD/ports/MBi/main/graphics/gdal

-- Martin
Comment 1 Martin Birgmeier 2023-02-05 09:38:33 UTC
The following patch solves the issue:

--- ./cmake/modules/packages/FindMySQL.cmake.ORIG       2023-01-02 15:38:16.000000000 +0100
+++ ./cmake/modules/packages/FindMySQL.cmake    2023-02-05 10:00:58.472127000 +0100
@@ -23,7 +23,7 @@
             "${MYSQL_VERSION_H}" )
 endif()
 
-find_library(MYSQL_LIBRARY NAMES mysqlclient mysqlclient_r)
+find_library(MYSQL_LIBRARY PATHS /usr/local/lib/mysql NAMES mysqlclient mysqlclient_r)
 
 if( NOT CMAKE_C_COMPILER_LOADED )
     message(AUTHOR_WARNING "C language not enabled: Skipping detection of extra link libraries.")

-- Martin
Comment 2 Martin Birgmeier 2023-02-05 10:54:03 UTC
One more issue: The ODBC port option is set, but /usr/local/include/cpl_odbc.h is not in pkg-plist.

-- Martin
Comment 3 Po-Chuan Hsieh freebsd_committer freebsd_triage 2023-02-05 15:09:53 UTC
(In reply to Martin Birgmeier from comment #1)

Is it not OK to use hard-coded path in a patch.
It should be better to fix it in a cmake way, e.g. using cmake variables instead.
But I need more time on this.

(In reply to Martin Birgmeier from comment #2)

I'll fix the ODBC part by installing the missing cpl_odbc.h first.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-02-05 16:05:52 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=269ce360399a65be8c468e976b80fe5483f8fe43

commit 269ce360399a65be8c468e976b80fe5483f8fe43
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-02-05 15:30:04 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-02-05 15:50:17 +0000

    graphics/gdal: Install cpl_odbc.h for ODBC option

    - Bump PORTREVISION for package change

    PR:             269256
    Reported by:    Martin Birgmeier <d8zNeCFG@aon.at>

 graphics/gdal/Makefile  | 2 ++
 graphics/gdal/pkg-plist | 1 +
 2 files changed, 3 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-09-04 09:11:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=18e5fa858bb60e1c70006acf2e6b966d411dd8de

commit 18e5fa858bb60e1c70006acf2e6b966d411dd8de
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-09-04 09:04:30 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-09-04 09:04:30 +0000

    graphics/gdal: Fix MYSQL option

    PR:             269256
    Reported by:    Martin Birgmeier <d8zNeCFG@aon.at>

 graphics/gdal/Makefile                |  1 +
 graphics/gdal/files/patch-mysql (new) | 11 +++++++++++
 2 files changed, 12 insertions(+)
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2023-09-04 09:21:39 UTC
Committed. Thanks!