-
Notifications
You must be signed in to change notification settings - Fork 0
Build ODBC statically on macOS #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: apache-odbc
Are you sure you want to change the base?
Conversation
Change unit tests to re-use code. Testing on windows is needed.
Now seeing error
```
Library not loaded: /usr/local/opt/grpc/lib/libgrpc++.1.76.dylib
```
on Excel.
Attempt to unlink arrow_flight.proto
Now I see ODBC.dylib has 100MB, and error from Excel is
```
Library not loaded: /usr/local/opt/libiodbc/lib/libiodbc.2.dylib
```
instead of looking for flightsql.
`iodbctest` command outside of Excel works.
in-progress link arrow statically for `flightsql-odbc`
* both ODBC driver and `arrow_odbc_spi_impl` need to link Arrow statically for tests to work.
* getting error
`File already exists in database: Flight.proto`
since the ODBC layer is linking dynamically while I successfully got `arrow_odbc_spi_impl` to link to Arrow statically
Draft for resolving `File already exists in database: FlightSql.proto` error
Note: make ODBC available on Excel first, test with `iodbctest`, worry about ODBC test executable later.
Add unix build (same as Windows build)
* Attempted to link static libraries with `arrow_odbc_spi_impl`, failed as it caused linking errors and rendered the ODBC driver unusable.
Undo changes to resolve broken driver
Resolves dependency errors
Attempt to switch to static build
Still getting error
```
[iODBC][Driver Manager]dlopen(/Library/ODBC/arrow-odbc/libarrow_flight_sql_odbc.2300.0.0.dylib, 0x0006): Library not loaded: @rpath/libarrow_flight_sql.2300.dylib
```
In-progress attempt to build ODBC statically on unix systems
In-progress changes to enable static odbc_impl library
pushing the changes just for saving my code. Currently odbc test still has double registration issue, work on this next. I think it should be solvable by either adding library flags or just using odbc spi shared. Because `odbc_spi_impl_test` works. And the ODBC tests worked just fine before I switched to static odbc spi impl.
Fix for gtest missing issue
Attempting to fix for issue:
IMPORTANT NOTICE - DO NOT IGNORE:
This test program did NOT call testing::InitGoogleTest() before calling RUN_ALL_TESTS().
This is INVALID. Soon Google Test will start to enforce the valid usage.
Please fix it ASAP, or IT WILL START TO FAIL.
Issue fixed with adding `${ARROW_TEST_LINK_LIBS}`. It is needed alongside `arrow_flight_testing_shared`.
IN-PROGRESS build static test on macOS
* Trying to have 2 builds. One `arrow_odbc_spi_impl_static` for static build and one `arrow_odbc_spi_impl_shared` for a shared lib that links Arrow dynamically
---
only committing the approach that worked.
Trying to work from `flight_sql_odbc_test` to debug the real issue.
Link 3rd party dependencies statically
Fix 3rd party headers cannot find issue for:
- boost xpressive and beast headers
- rapidjson headers
Resolve unneeded link for ODBC
----
Moving `set(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".a")` up didn't seem to have any effect
----
Fix for static gRPC connection issue:
export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=/etc/ssl/cert.pem
Fix cares `cannot modify alias target` issue
Make arrow_odbc_spi_impl static lib
In progress for getting gprc linked statically
Add debug msgs in add_arrow_lib BuildUtils.cmake
Remove commented out code in odbc lib
Fix build issue from odbc impl tests
Added draft code for Link Arrow libs statically on Unix for unit tests
Add commented out code`ARROW_DEPENDENCY_USE_SHARED` in ODBC cpp yml
Uncomment when it is verified to work.
In-progress Fix ODBC test build and make it run.
Build executable from scratch
Revert "Build executable from scratch"
This reverts commit a51dc39.
Dummy test
dummy test without using ODBC passed without double registration issue
Make ODBC test run
Issue to resolve:
[libprotobuf FATAL /path/to/arrow/cpp/debug-build/_deps/protobuf-src/src/google/protobuf/extension_set.cc:100] Multiple extension registrations for type "google.protobuf.MessageOptions", field number 1000.
unknown file: Failure
C++ exception with description "Multiple extension registrations for type "google.protobuf.MessageOptions", field number 1000." thrown in SetUp().
Fix: only link test executable directly with ODBC shared dylib. Do not link test executable with odbc spi impl dylib. And change ODBC to link odbc spi impl dylib publicly instead of privately
Can revert later
As dependencies are static and built from source
Resolves the issue of ODBC on macOS being dynamically linked to ODBC
Need to check if Windows CI passes
- Remove dummy tests - Remove unneeded changes
This reverts commit 711b3e0.
| @@ -3026,6 +3031,10 @@ function(build_cares) | |||
| find_library(LIBRESOLV_LIBRARY NAMES resolv libresolv REQUIRED) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this change, we have failed run with c-ares::cares: https://github.com/Bit-Quill/arrow/actions/runs/21459770235/job/61809740997?pr=153#step:7:540
Fixes error:
CMake Error at cmake_modules/ThirdpartyToolchain.cmake:3032 (set_target_properties):
set_target_properties can not be used on an ALIAS target.
| ValidateSetStmtAttrErrorCode(this->stmt, SQL_ATTR_IMP_PARAM_DESC, | ||
| static_cast<SQLULEN>(0), | ||
| static_cast<SQLULEN>(0), SQL_ERROR, | ||
| #ifdef __APPLE__ | ||
| // iODBC on MacOS returns SQL_INVALID_HANDLE for this case | ||
| SQL_INVALID_HANDLE, | ||
| // static iODBC on MacOS returns IM001 for this case | ||
| kErrorStateIM001); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justing-bq Could you kindly let me know if this change breaks tests on ARM macOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatementAttributeTests all pass on my machine with your change.
|
Converting PR to draft due to new test issues I found |
Fixes issue: ``` mimalloc: assertion failed: at "arrow/cpp/debug-build/mimalloc_ep-prefix/src/mimalloc_ep/include/mimalloc/internal.h":658, _mi_ptr_page assertion: "p==NULL || mi_is_in_heap_region(p)" zsh: abort debug/arrow-flight-sql-odbc-test ```
|
Test issue resolved on Intel mac |
| - name: Install Dependencies | ||
| run: | | ||
| brew bundle --file=cpp/Brewfile | ||
| # We want to use bundled RE2 for static linking. If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some blank lines for readability?
| arrow_compute_static | ||
| Boost::locale | ||
| Boost::headers | ||
| RapidJSON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need iodbc anymore?
| ValidateSetStmtAttrErrorCode(this->stmt, SQL_ATTR_IMP_PARAM_DESC, | ||
| static_cast<SQLULEN>(0), | ||
| static_cast<SQLULEN>(0), SQL_ERROR, | ||
| #ifdef __APPLE__ | ||
| // iODBC on MacOS returns SQL_INVALID_HANDLE for this case | ||
| SQL_INVALID_HANDLE, | ||
| // static iODBC on MacOS returns IM001 for this case | ||
| kErrorStateIM001); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatementAttributeTests all pass on my machine with your change.
.DYLIBfile to use the driver. New flags that are needed for build: