[odb-users] Got "locally defined symbol imported" with pkg-config
and dynamic linking
acsvln
acsvln at disroot.org
Thu May 26 05:37:50 EDT 2022
Hello! I am trying to link qmake project with odb lib's dynamically, and
stucked with linking process, got lots of warning messages like:
A-odb.obj : warning LNK4049: locally defined symbol ??3shared_base at details@odb@@SAXPEAX at Z (public: static void __cdecl odb::details::shared_base::operator delete(void *)) imported
B-odb.obj : warning LNK4049: locally defined symbol ??3shared_base at details@odb@@SAXPEAX at Z (public: static void __cdecl odb::details::shared_base::operator delete(void *)) imported
C-odb.obj : warning LNK4049: locally defined symbol ??3shared_base at details@odb@@SAXPEAX at Z (public: static void __cdecl odb::details::shared_base::operator delete(void *)) imported
My .pro file looks like:
...
CONFIG += link_pkgconfig
PKGCONFIG += libicuuc.shared libicui18n.shared libodb.shared libodb-qt.shared libodb-sqlite.shared libodb-pgsql.shared libpq.shared libcrypto.shared libssl.shared libz.shared
...
i looked at my install folder and found there .lib files and dll.lib
lib-files:
crypto.dll.lib
crypto.lib
odb-pgsql.dll.lib
odb-pgsql.lib
odb-qt.dll.lib
odb-qt.lib
odb-sqlite.dll.lib
odb-sqlite.lib
odb.dll.lib
odb.lib
pq.dll.lib
pq.lib
sqlite3.dll.lib
sqlite3.lib
ssl.dll.lib
ssl.lib
z.dll.lib
z.lib
Manually checked what pkg-config returns:
C:\Windows\System32>pkg-config libodb-pgsql.static --cflags --libs --msvc-syntax
-DLIBODB_PGSQL_BUILD2 -DLIBODB_PGSQL_STATIC -IC:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\include /libpath:C:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\lib odb-pgsql.lib odb.lib
C:\Windows\System32>pkg-config libodb-pgsql.shared --cflags --libs --msvc-syntax
-DLIBODB_PGSQL_BUILD2 -DLIBODB_PGSQL_SHARED -IC:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\include /libpath:C:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\lib odb-pgsql.lib odb.lib
After that, i manually fixed pkg-config files, to link with .dll.lib
files e.x:
From:
Name: libcrypto
Version: 1.1.1+16
Description: C library providing general cryptography and X.509 support
URL:https://www.openssl.org/
Cflags: -IC:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\include
Libs: -LC:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\lib -lcrypto
To:
Name: libcrypto
Version: 1.1.1+16
Description: C library providing general cryptography and X.509 support
URL:https://www.openssl.org/
Cflags: -IC:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\include
Libs: -LC:\\Temp\\dependencies\\install\\x64\\build2\\libodb-pgsql\\release\\lib -lcrypto.dll
And now it working!
Wanna to ask, is that bug and what i must do in my situation?
My environment:
Windows 10
MSVC: 19.16.27045
Qt: 5.14.2
pkg-config: 0.26, from
https://download.gnome.org/binaries/win32/dependencies/
build2-toolchain: 0.14
More information about the odb-users
mailing list