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

[email protected] #3277

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

Vertexwahn
Copy link
Contributor

@Vertexwahn Vertexwahn commented Nov 27, 2024

Adds [email protected]

When using [email protected] with Windows as a dependency in a cc_test I get the following link error:

Linking okapi/cli/cli_test.exe failed: (Exit 1120): link.exe failed: error executing CppLink command (from target //okapi/cli:cli_test) C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX64\x64\link.exe @bazel-out/x64_windows-opt/bin/okapi/cli/cli_test.exe-2.params
LINK : warning LNK4044: unrecognized option '/lm'; ignored
cli.lib(cli.obj) : error LNK2019: unresolved external symbol BCryptCloseAlgorithmProvider referenced in function "public: __cdecl boost::uuids::random_generator_pure::~random_generator_pure(void)" (??1random_generator_pure@uuids@boost@@QEAA@XZ)
cli.lib(cli.obj) : error LNK2019: unresolved external symbol BCryptGenRandom referenced in function "int __cdecl de_vertexwahn::cli_main(int,char * *)" (?cli_main@de_vertexwahn@@YAHHPEAPEAD@Z)
cli.lib(cli.obj) : error LNK2019: unresolved external symbol BCryptOpenAlgorithmProvider referenced in function "int __cdecl de_vertexwahn::cli_main(int,char * *)" (?cli_main@de_vertexwahn@@YAHHPEAPEAD@Z)
bazel-out\x64_windows-opt\bin\okapi\cli\cli_test.exe : fatal error LNK1120: 3 unresolved externals
Target //okapi/cli:cli_test failed to build

By adding -defaultlib:bcrypt.lib as a needed library the error is fixed.

Minimal Demo to reproduce linker errors:

cli.cpp:

#include "boost/uuid/uuid.hpp"
#include "boost/uuid/uuid_generators.hpp"
#include "boost/uuid/uuid_io.hpp"

int main() {
    boost::uuids::random_generator gen;
    boost::uuids::uuid id = gen();

    return 0;
}

BUILD.bazel:

cc_binary(
    name = "cli",
    srcs = ["cli.cpp"],
    deps = [
        "@boost.program_options//:boost.program_options",
        "@boost.uuid//:boost.uuid",
    ],
)

MODULE.bazel:

bazel_dep(name = "boost.uuid", version = "1.83.0.bcr.1")
bazel_dep(name = "boost.program_options", version = "1.83.0.bcr.1")

@Vertexwahn
Copy link
Contributor Author

@bazel-io skip_check unstable_url

@bazel-io bazel-io added the skip-url-stability-check Skip the URL stability check for the PR label Nov 27, 2024
@Vertexwahn
Copy link
Contributor Author

@wep21 I added you as a maintainer for boost.uuid - is this fine for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-url-stability-check Skip the URL stability check for the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants