Skip to content
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

[WIP] Make clickhouse-odbc self contained library for linux #452

Closed
wants to merge 39 commits into from

Conversation

alesapin
Copy link
Member

@alesapin alesapin commented Sep 3, 2024

Now it builds for Linux, but I've messed CMake completely. Need to carefully cleanup Cmake so builds for Windows will still work.

Fixes #428

@alesapin alesapin mentioned this pull request Sep 3, 2024
@alesapin
Copy link
Member Author

alesapin commented Sep 3, 2024

TODO:
"Unmessup" Cmake:

  1. Drop non-icu build support for Linux (and MacOS?) since we have it in contrib
  2. Properly handle all architectures and preserve build for windows.

@alesapin
Copy link
Member Author

alesapin commented Sep 3, 2024

alesapin:build/ (add_odbc) $ ldd ./driver/test/clickhouse-odbc-client-it                                                                                                                                 
	linux-vdso.so.1 (0x00007ffef47c5000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f0d36e6a000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f0d39041000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f0d36d7b000)
alesapin:build/ (add_odbc) $ ldd driver/libclickhouseodbc.so                                                                                                                                             
	linux-vdso.so.1 (0x00007fffa81dc000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f6ba1761000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f6ba3f8f000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f6ba1672000)

If it will be not too complex I'll go further and add glibc-compatibility.

@alesapin
Copy link
Member Author

alesapin commented Sep 6, 2024

image
I think I'll drop iODBC support, at least for mac and linux.

@alesapin
Copy link
Member Author

alesapin commented Sep 9, 2024

Need to add CI runners for MacOS....

@alesapin
Copy link
Member Author

alesapin commented Sep 9, 2024

Two tasks:

  1. Fix build for Windows. Will take unpredictable amount of time, but I'll try.
  2. Introduce CI for MacOS.

@alesapin
Copy link
Member Author

Segfaults for macOS when try to dlopen this library:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000000000000
    frame #1: 0x0000000103122078 libclickhouseodbc.dylibstd::__1::__stdinbuf<char>::imbue(std::__1::locale const&) [inlined] std::__1::codecvt<char, char, __mbstate_t>::encoding[abi:v15007](this=<unavailable>) const at __locale:996:16 [opt]
    frame #2: 0x000000010312206c libclickhouseodbc.dylibstd::__1::__stdinbuf<char>::imbue(this=0x00000001050edf48, __loc=<unavailable>) at __std_stream:84:26 [opt]
    frame #3: 0x0000000103121ac8 libclickhouseodbc.dylibstd::__1::DoIOSInit::DoIOSInit() [inlined] std::__1::__stdinbuf<char>::__stdinbuf(this=0x00000001050edf48, __fp=0x00000001faea4318, __st=<unavailable>) at __std_stream:76:5 [opt]
    frame #4: 0x0000000103121a70 libclickhouseodbc.dylibstd::__1::DoIOSInit::DoIOSInit() [inlined] std::__1::__stdinbuf<char>::__stdinbuf(this=0x00000001050edf48, __fp=0x00000001faea4318, __st=<unavailable>) at __std_stream:75:1 [opt]
    frame #5: 0x0000000103121a70 libclickhouseodbc.dylibstd::__1::DoIOSInit::DoIOSInit(this=0x00000001050ee498) at iostream.cpp:120:59 [opt]
    frame #6: 0x0000000103122f1c libclickhouseodbc.dylib_GLOBAL__I_000100 + 68
    frame #7: 0x0000000192cde608 dyldinvocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const::$_0::operator()() const + 168
    frame #8: 0x0000000192d1cb38 dyldinvocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 172
    frame #9: 0x0000000192d10400 dyldinvocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 496
    frame #10: 0x0000000192cbf2fc dylddyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 300
    frame #11: 0x0000000192d0f394 dylddyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 192
    frame #12: 0x0000000192d11c6c dylddyld3::MachOFile::forEachInitializerPointerSection(Diagnostics&, void (unsigned int, unsigned int, bool&) block_pointer) const + 160
    frame #13: 0x0000000192d1c82c dylddyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 432
    frame #14: 0x0000000192cda53c dylddyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 564
    frame #15: 0x0000000192ce0bc0 dylddyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&) const + 36
    frame #16: 0x0000000192cda984 dylddyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 220
    frame #17: 0x0000000192cde698 dylddyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_1::operator()() const + 116
    frame #18: 0x0000000192cdab78 dylddyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 420
    frame #19: 0x0000000192cf6d30 dylddyld4::APIs::dlopen_from(char const*, int, void*) + 1876
    frame #20: 0x0000000100002d40 clickhouse-odbc-load-utPoco::SharedLibraryImpl::loadImpl(this=0x000000016fdff598, path="/Users/ec2-user/clickhouse-odbc-clean/build/driver/libclickhouseodbc.dylib", flags=0) at SharedLibrary_UNIX.cpp:50:12 [opt]
    frame #21: 0x0000000100002f44 clickhouse-odbc-load-utPoco::SharedLibrary::SharedLibrary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) [inlined] Poco::SharedLibrary::SharedLibrary(this=0x000000016fdff590, path=<unavailable>) at SharedLibrary.cpp:36:2 [opt]
    frame #22: 0x0000000100002f1c clickhouse-odbc-load-utPoco::SharedLibrary::SharedLibrary(this=0x000000016fdff590, path=<unavailable>) at SharedLibrary.cpp:35:1 [opt]
    frame #23: 0x000000010003f984 clickhouse-odbc-load-utmain + 264
    frame #24: 0x0000000192cc3154 dyldstart + 2476
(lldb) 

No idea yet

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ alesapin
❌ ec2-user


ec2-user seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@alesapin
Copy link
Member Author

Sorry testflows, I've really tried:

      Start 10: parametrized-regression.py-3-dsn-1
10/11 Test #10: parametrized-regression.py-3-dsn-1 ...***Failed    0.25 sec
/opt/homebrew/Cellar/[email protected]/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 2 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
Segmentation fault

@alesapin alesapin mentioned this pull request Sep 16, 2024
@alesapin
Copy link
Member Author

I'm working on windows build in a separate branch https://github.com/ClickHouse/clickhouse-odbc/tree/add_windows

@alesapin
Copy link
Member Author

alesapin commented Oct 2, 2024

Suppressed by #456

@alesapin alesapin closed this Oct 2, 2024
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.

The driver is obviously wrong
2 participants