Как разрешить неопределенный символ из слабого символа (w) в зависимой библиотеке в БазелеC++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 Как разрешить неопределенный символ из слабого символа (w) в зависимой библиотеке в Базеле

Сообщение Anonymous »

У меня есть проект Bazel с двумя библиотеками, библиотека CORE_IMPL Нижнего уровня и обертка более высокого уровня. Вот их файлы сборки: < /p>

Код: Выделить всё

load("//bazel:bundle.bzl", "bundle_cc_hdrs", "bundle_files")
load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external")

cc_library(
name = "diskann_impl",
srcs = [
"xxx/src/*.cpp",
"xxx/src/index.cpp",
],
hdrs = glob([
"xxx/**/*.h",
]),
strip_include_prefix = "xxx/include",
include_prefix = "",
linkopts = [
"-lgomp",
"-lgfortran",
],
deps = [
"//path/to/some/dep",
"@some_external_dep//:dep",
],
alwayslink = True,
copts = ["-mavx", "-msse2", "-ftree-vectorize", "-fno-builtin-malloc", "-fno-builtin-calloc",
"-fno-builtin-realloc", "-fno-builtin-free", "-fopenmp", "-fopenmp-simd", "-funroll-loops",
"-Wfatal-errors", "-DENABLE_CUSTOM_LOGGER=1"],
visibility = ["//visibility:public"],
)
< /code>
load("//bazel:bundle.bzl", "bundle_cc_hdrs", "bundle_files")

cc_library(
name = "diskann_cc",
srcs = glob([
"*.cc",
]),
hdrs = glob([
"*.h",
]),
include_prefix = "diskann",
linkopts = [
],
deps = [
"//path/to/another/dep",
"//path/to/diskann_impl:diskann_impl",
],
alwayslink = True,
copts = ["-fPIC", "-DENABLE_CUSTOM_LOGGER=1"],
visibility = ["//visibility:public"],
)

cc_binary(
name = "libknn_diskann.so",
deps = [
":diskann_cc",
"//path/to/diskann_impl:diskann_impl",
],
linkshared = True,
visibility = ["//visibility:public"],
)
< /code>
Template class diskann::Index
явно определено в index.cpp библиотеки Diskann_impl.
template DISKANN_DLLEXPORT class Index;
< /code>
Building the diskann_cc target produces libdiskann.lo and libdiskann.so. Using the nm command, I can see that diskann::Index::build is an undefined symbol (U) in these files.
U diskann::Index::build(float const*, unsigned long, diskann::parameters const&, std::vector const&, bool)
< /code>
When I inspect the .lo file from diskann_impl, nm shows that this same symbol is a weak symbol (W).
00000000004e4424 W diskann::Index::build(float const*, unsigned long, diskann::parameters const&, std::vector const&, bool)
< /code>
How can I resolve the undefined symbol problem?

Подробнее здесь: https://stackoverflow.com/questions/797 ... nt-library
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C++»