Undefined symbol errors when consuming the library as shared/dynamic

Open
#205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cmake, cpp
Domain
build-system

Research direction

Start with the visibility setting at CMakeLists.txt#L77 and reproduce the undefined-symbol errors when consuming the library as a shared object. Compare the listed visibility approaches and confirm that the chosen change preserves static-library use while exposing the symbols required by shared-library consumers.

Written by the indexing model from the issue text.

Description

The "-fvisibility=hidden" (see CMakeLists.txt#L77) in CMakeLists.txt causes undefined symbols errors when using this library as shared object.

It's not a problem when using it as a static library because visibility settings doesn't affect that by design.

There are multiple solutions for this problem:

  1. Just remove "-fvisibility=hidden". We are currently using this approach as a workaround because we currently don't have many symbols to be considered private, this may be a viable option.
  2. Keep "-fvisibility=hidden" and manually annotate symbols intended to be public with: __attribute__((visibility("default"))), however, this will require a significant amount of effort.
  3. Replace "-fvisibility=hidden" with "-fvisibility=default" and manually annotate symbols intended to be private with __attribute__((visibility("hidden")))
Dominant language
C++
Stars
465
Forks
98
Avg merge
1h 16m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from awslabs/aws-lambda-cpp

All issues in awslabs/aws-lambda-cpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.