Skip to content

Conversation

henderkes
Copy link
Contributor

Background: when statically compiling libodbc.a with libiconv.a, linking against only libodbc.a leads to unresolved external symbols to libiconv_* functions.

Here we add an optional SWOOLE_ODBC_LIBC variable if the odbc library needs more than to link against a single library.

Now ./configure --enable-swoole-odbc=unixodbc,/path/to/unixodbc SWOOLE_ODBC_LIBS="-lodbc -liconv" succeeds.

Feel free to change this to a better way if you can think of one! crazywhalecc/static-php-cli#864

@henderkes henderkes changed the title add SWOOLE_ODBC_LIBC variable to config.m4 add SWOOLE_ODBC_LIBS variable to config.m4 Aug 25, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for specifying custom ODBC library linking flags through a new SWOOLE_ODBC_LIBS environment variable to address linking issues when statically compiling ODBC libraries with additional dependencies like libiconv.

  • Introduces optional SWOOLE_ODBC_LIBS variable to specify custom linking flags for ODBC
  • Refactors library checking from PHP_CHECK_LIBRARY to AC_LINK_IFELSE for better compatibility with custom library configurations
  • Preserves existing behavior when SWOOLE_ODBC_LIBS is not set
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <[email protected]>
config.m4 Outdated
PHP_CHECK_LIBRARY($pdo_odbc_def_lib, SQLAllocHandle,
[], [
AC_MSG_ERROR([
save_LIBS="$LIBS"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The save_LIBS should be changed to uppercase

@matyhtf matyhtf merged commit f819fa8 into swoole:master Sep 10, 2025
41 of 47 checks passed
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.13%. Comparing base (8057ba9) to head (d5676e8).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5847      +/-   ##
==========================================
- Coverage   86.15%   86.13%   -0.03%     
==========================================
  Files         109      109              
  Lines       16820    16820              
  Branches     2975     2975              
==========================================
- Hits        14492    14488       -4     
- Misses       2328     2332       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants