Understand how chdb-go locates the libchdb engine
mainAt runtime, chdb-go searches for libchdb using the following priority order:
CHDB_LIB_PATH: If this environment variable is set, it points directly to the library file. This disables all other search methods. If the file at this path is invalid, it results in an error.- Embedded Engine: If the build imports an engine module (e.g.,
lib/embedded), the engine inside the binary is used. No further searching occurs. - Executable Directory: The directory containing the running executable.
PATH: Standard system path search.- System Library Paths:
/usr/local/lib,/opt/homebrew/lib, and/usr/lib. - Dynamic Loader Paths: Directories in
LD_LIBRARY_PATH,DYLD_LIBRARY_PATH, andDYLD_FALLBACK_LIBRARY_PATH. - Dynamic Loader: Search by name (e.g.,
ldconfig-registered installs orRUNPATH).
Tip: Use chdbpurego.LoadedLibraryPath() to log the absolute path of the library actually being used by your process.