Open
Description
What would you like help with?
Hi,
I'm trying to use ADBC with a Microsoft Visual Studio C++ solution. I've tried to build ADBC to produce an import lib file (.lib extension) and dynamic dll (.dll) but haven't had any luck. I tried using cmake with clang and gcc through Mingw, but I only get '.a' files rather than '.lib' ones, and the compilation fails because of dllexport.
Is there any guidance of linking ADBC with C++ Windows DLLs? I'm specifically wanting to use the flightsql driver.
Thanks.
Activity
WillAyd commentedon May 22, 2025
Hmm that's strange - can you share the error message the linker is providing?
lidavidm commentedon May 22, 2025
You're likely running into something like #634 (comment)
I haven't managed to figure this out myself (it doesn't help that Microsoft no longer provides developer VMs)
WillAyd commentedon May 22, 2025
I don't have a windows machine to test this out on, but maybe the Meson configuration works here? It looks like that is generating the expected extension:
arrow-adbc/c/driver/flightsql/meson.build
Line 21 in e08f484
To try locallly you would have to run this from the c directory:
IIFE commentedon May 22, 2025
Thanks @WillAyd . Tried that but unfortunately still no further ahead. This is the meson log generated:
IIFE commentedon May 22, 2025
@WillAyd @lidavidm
This preset allows the Ninja build to complete, however, it only produces a
.dll
but no.lib
for the import lib, which means I can't link my dll/exe against the binaries. Furthermore, I needed to suppress warnings as errors, as the build flagsdllexport
with this error example. This probably means the symbols from the generated DLLs are not exported for windows clients?C:/dev/arrow-adbc/c/include/arrow-adbc/adbc.h:318:1: error: 'dllimport' attribute ignored [-Werror=attributes]
WillAyd commentedon May 22, 2025
That looks like a configuration issue, but not a compile time one. I see you have this in your log:
Can you make sure you are setting up the project with
-Dtests=enabled
? It's an unrelated bug to require tests to build flightsql, but setting that option for now should help you move forwardIIFE commentedon May 22, 2025
Thanks. When I try with tests enabled, this error occurs:
WillAyd commentedon May 22, 2025
Ugh...OK. Sorry that configuration is not well tested on Windows...
For one more minor tweak, you can try changing this line:
arrow-adbc/c/driver_manager/meson.build
Line 18 in e08f484
to:
IIFE commentedon May 22, 2025
That resolved the
setup
command, but now the compile command is failing with not much info, seems the ninja generator is suddenly stopping:WillAyd commentedon May 22, 2025
Well looks like things are borked there too...I am not an expert in Windows symbol visibility but we might need to ensure our configurations (both CMake and Meson) are handling that properly for this to work.
IIFE commentedon May 22, 2025
@WillAyd I've managed to get a little bit further with Visual Studio 2022 by using this preset:
I can build the sqlite driver and run its tests successfully. However, if I turn
ADBC_DRIVER_FLIGHTSQL
ON, I get this link error:Feels like we're closer now but a bit confused with this latest error.
IIFE commentedon May 22, 2025
P.S: I'm mainly familiar with Windows dev using Visual Studio, so cmake is a bit foreign to me :)
lidavidm commentedon May 22, 2025
What happens if you just go into
go/adbc/pkg
andmake
? That will directly invoke Go to build a DLL, and hopefully a LIB. If it doesn't generate a LIB, we may be out of luck (I believe Go has to do that)IIFE commentedon May 23, 2025
I think I may have figured it out. Go doesn't generate a LIB it seems. However, I think we can generate a DEF and LIB from the DLL itself. Putting something together to test. If it works I'll send a PR for consideration.