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

Linking libboost_uuid fails for MinGW GCC #2

Open
karen-arutyunov opened this issue May 10, 2024 · 0 comments
Open

Linking libboost_uuid fails for MinGW GCC #2

karen-arutyunov opened this issue May 10, 2024 · 0 comments

Comments

@karen-arutyunov
Copy link
Member

Linking libboost_uuid library may fail as follows for MinGW GCC:

g++ -Wno-unknown-pragmas -std=c++23 -o odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.o odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\employee-odb.exe.o libodb-boost-2.5.0-b.26.20240510100355.a1356c21348f\odb\boost\libodb-boost.dll.a libboost-random-1.83.0\src\libboost_random.dll.a libboost-container-1.83.0\src\libboost_container.dll.a libodb-sqlite-2.5.0-b.26.20240510100355.a1356c21348f\odb\sqlite\libodb-sqlite.dll.a libodb-2.5.0-b.26.20240510100355.a1356c21348f\odb\libodb.dll.a libsqlite3-3.39.4+1\libsqlite3\libsqlite3.dll.a odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.manifest.o
C:/build2/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.o:driver.cxx:(.text$_ZN5boost5uuids6detail20random_provider_baseC2Ev[_ZN5boost5uuids6detail20random_provider_baseC2Ev]+0x3b): undefined reference to `BCryptOpenAlgorithmProvider'
C:/build2/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.o:driver.cxx:(.text$_ZN5boost5uuids6detail20random_provider_base16get_random_bytesEPvy[_ZN5boost5uuids6detail20random_provider_base16get_random_bytesEPvy]+0x43): undefined reference to `BCryptGenRandom'
C:/build2/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.o:driver.cxx:(.text$_ZN5boost5uuids6detail20random_provider_base7destroyEv[_ZN5boost5uuids6detail20random_provider_base7destroyEv]+0x28): undefined reference to `BCryptCloseAlgorithmProvider'
collect2.exe: error: ld returned 1 exit status

The odb-examples package reproduces (but temporary works around) this issue (see boost/buildfile for details).

It seems that libboost_uuid is missing Bcrypt library linkage on Windows. Note, however, that linking libboost_uuid succeeds for MSVC for some reason:

"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\link.exe" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64" /NOLOGO /MACHINE:x64 /INCREMENTAL:NO /DEFAULTLIB:shell32 /DEFAULTLIB:user32 /MANIFEST:EMBED /MANIFESTINPUT:odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.manifest /IMPLIB:odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.lib /OUT:odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\driver.exe.obj odb-examples-2.5.0-b.26.20240510100355.a1356c21348f\boost\employee-odb.exe.obj libodb-boost-2.5.0-b.26.20240510100355.a1356c21348f\odb\boost\odb-boost.dll.lib libboost-random-1.83.0\src\boost_random.dll.lib libboost-container-1.83.0\src\boost_container.dll.lib libodb-sqlite-2.5.0-b.26.20240510100355.a1356c21348f\odb\sqlite\odb-sqlite.dll.lib libodb-2.5.0-b.26.20240510100355.a1356c21348f\odb\odb.dll.lib libsqlite3-3.39.4+1\libsqlite3\sqlite3.dll.lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant