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

Getting Compilation error: absl::bad_variant_access #3065

Closed
krishna-ezlo opened this issue Sep 19, 2024 · 7 comments
Closed

Getting Compilation error: absl::bad_variant_access #3065

krishna-ezlo opened this issue Sep 19, 2024 · 7 comments
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@krishna-ezlo
Copy link

Please help me resolve the issue!

I'm using ubuntu and followed the tutorials from
https://opentelemetry.io/docs/languages/cpp/getting-started and, https://opentelemetry.io/docs/languages/cpp/exporters/

Additionally:

  1. Installed abseil-cpp from github
  2. Installed protobuf from ubuntu-software
  3. Installed gRPC from github

the command i've used to compile opentelemetry-cpp is:

cmake -DBUILD_TESTING:BOOL=OFF     -DBUILD_SHARED_LIBS:BOOL=ON     -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON     -DWITH_JAEGER:BOOL=OFF     -DWITH_OTLP_HTTP:BOOL=OFF     -DWITH_OTLP_GRPC:BOOL=OFF     -DWITH_PROMETHEUS:BOOL=OFF     -DWITH_ZIPKIN:BOOL=OFF     -DWITH_EXAMPLES:BOOL=OFF     -DOTELCPP_VERSIONED_LIBS:BOOL=ON     -DBUILD_PACKAGE=ON     -DWITH_ABSEIL=ON     -DWITH_STL=ON     -DCMAKE_PREFIX_PATH=/usr/alpen     ..

Here is what I'm getting in console:

Terminal Command:

.../otel-cpp-starter/roll-dice/build$ cmake ..

Terminal Response:

-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found opentelemetry-cpp: /media/nds/projects/nds/ezlo/opentelemetry/otel-cpp-starter/otel-cpp/include  
-- Configuring done (0.3s)

CMake Error at /media/nds/projects/nds/ezlo/opentelemetry/otel-cpp-starter/otel-cpp/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake:61 (set_target_properties):
  The link interface of target "opentelemetry-cpp::api" contains:

    absl::bad_variant_access

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /media/nds/projects/nds/ezlo/opentelemetry/otel-cpp-starter/otel-cpp/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake:92 (include)
  CMakeLists.txt:24 (find_package)


CMake Error at /media/nds/projects/nds/ezlo/opentelemetry/otel-cpp-starter/otel-cpp/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake:77 (set_target_properties):
  The link interface of target "opentelemetry-cpp::common" contains:

    absl::strings

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /media/nds/projects/nds/ezlo/opentelemetry/otel-cpp-starter/otel-cpp/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake:92 (include)
  CMakeLists.txt:24 (find_package)


-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
@krishna-ezlo krishna-ezlo added the bug Something isn't working label Sep 19, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 19, 2024
@owent
Copy link
Member

owent commented Sep 19, 2024

Please add find_package(absl CONFIG) into cmake script file of your project.
We should have documents about this problem.

@krishna-ezlo
Copy link
Author

Please add find_package(absl CONFIG) into cmake script file of your project. We should have documents about this problem.

This solution did solved the above mentioned issue, but now I've encountered another error, although it is available at "../../otel-cpp/lib":

./dice-server: error while loading shared libraries: libopentelemetry_otlp_recordable.so.1: cannot open shared object file: No such file or directory

@owent
Copy link
Member

owent commented Sep 20, 2024

cts/nds/ezlo/opentelemetry/otel-cp

Please add find_package(absl CONFIG) into cmake script file of your project. We should have documents about this problem.

This solution did solved the above mentioned issue, but now I've encountered another error, although it is available at "../../otel-cpp/lib":

./dice-server: error while loading shared libraries: libopentelemetry_otlp_recordable.so.1: cannot open shared object file: No such file or directory

Do you install otel-cpp? cmake --build <BUILD DIR> -j && cmake --install <BUILD DIR> --prefix <INSTALL PREFIX> can be used to install all components.

<INSTALL PREFIX> may be /usr/alpen according to the command used to compile opentelemetry-cpp.

@marcalff marcalff added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 23, 2024
@krishna-ezlo
Copy link
Author

cts/nds/ezlo/opentelemetry/otel-cp

Please add find_package(absl CONFIG) into cmake script file of your project. We should have documents about this problem.

This solution did solved the above mentioned issue, but now I've encountered another error, although it is available at "../../otel-cpp/lib":

./dice-server: error while loading shared libraries: libopentelemetry_otlp_recordable.so.1: cannot open shared object file: No such file or directory

Do you install otel-cpp? cmake --build <BUILD DIR> -j && cmake --install <BUILD DIR> --prefix <INSTALL PREFIX> can be used to install all components.

<INSTALL PREFIX> may be /usr/alpen according to the command used to compile opentelemetry-cpp.

@owent
I'm not able to figure out what you want to convey.

Although, I tried installing "opentelemetry-cpp" using cmake --install .
It got installed at "/usr/local/lib"
But, problem still resides.

@krishna-ezlo
Copy link
Author

Hi @owent
Are you available ?
Please help me debugging the issue whenever you are available
or Anybody else can help me fix this issue

@owent
Copy link
Member

owent commented Sep 25, 2024

cts/nds/ezlo/opentelemetry/otel-cp

Please add find_package(absl CONFIG) into cmake script file of your project. We should have documents about this problem.

This solution did solved the above mentioned issue, but now I've encountered another error, although it is available at "../../otel-cpp/lib":

./dice-server: error while loading shared libraries: libopentelemetry_otlp_recordable.so.1: cannot open shared object file: No such file or directory

Do you install otel-cpp? cmake --build <BUILD DIR> -j && cmake --install <BUILD DIR> --prefix <INSTALL PREFIX> can be used to install all components.
<INSTALL PREFIX> may be /usr/alpen according to the command used to compile opentelemetry-cpp.

@owent I'm not able to figure out what you want to convey.

Although, I tried installing "opentelemetry-cpp" using cmake --install . It got installed at "/usr/local/lib" But, problem still resides.

But the messages before show it's found in /media/nds/projects/nds/ezlo/opentelemetry/otel-cpp-starter/otel-cpp/lib/, not in /usr/local/lib. Do you add this direcoty into CMAKE_PACKAGE_PREFIX or CMAKE_FIND_ROOT_PATH ? We should make cmake find packages from installed directories first.

@krishna-ezlo
Copy link
Author

hi @owent
The issue is solved

I made mistake while compiling opentelemetry-cpp at DCMAKE_PREFIX_PATH.

It was:

cmake -DBUILD_TESTING:BOOL=OFF     -DBUILD_SHARED_LIBS:BOOL=ON     -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON     -DWITH_JAEGER:BOOL=OFF     -DWITH_OTLP_HTTP:BOOL=OFF     -DWITH_OTLP_GRPC:BOOL=OFF     -DWITH_PROMETHEUS:BOOL=OFF     -DWITH_ZIPKIN:BOOL=OFF     -DWITH_EXAMPLES:BOOL=OFF     -DOTELCPP_VERSIONED_LIBS:BOOL=ON     -DBUILD_PACKAGE=ON     -DWITH_ABSEIL=ON     -DWITH_STL=ON     -DCMAKE_PREFIX_PATH=/usr/alpen     ..

I should:

cmake -DBUILD_TESTING:BOOL=OFF     -DBUILD_SHARED_LIBS:BOOL=ON     -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON     -DWITH_JAEGER:BOOL=ON     -DWITH_OTLP_HTTP:BOOL=ON     -DWITH_OTLP_GRPC:BOOL=ON     -DWITH_PROMETHEUS:BOOL=OFF     -DWITH_ZIPKIN:BOOL=OFF     -DWITH_EXAMPLES:BOOL=OFF     -DOTELCPP_VERSIONED_LIBS:BOOL=ON     -DBUILD_PACKAGE=ON     -DWITH_ABSEIL=ON     -DWITH_STL=ON     -DCMAKE_PREFIX_PATH=/media/nds/projects/nds/ezlo/opentelemetry/otel-cpp-starter/otel-cpp ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants
@owent @marcalff @krishna-ezlo and others