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

Fix crashes in GCC 4.x shared-libs builds, due to recent symbol visibility changes #675

Merged
merged 6 commits into from
Nov 4, 2024

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Nov 1, 2024

Issue:
When building with GCC 4.8 and 4.9 and -DBUILD_SHARED_LIBS=ON, many tests were crashing. The crashes would say something like "free(): invalid pointer" and the stack trace would point into the c++ string headers.

Things we tried

Description of Changes:
Don't set visibility to hidden for GCC < 5. That's how we had it before. GCC 4.x is very old. This isn't the first time it's disappointed us

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@graebm graebm marked this pull request as ready for review November 2, 2024 00:18
@graebm graebm merged commit c21e255 into main Nov 4, 2024
60 checks passed
@graebm graebm deleted the visibility-issues branch November 4, 2024 18:55
sbera87 pushed a commit that referenced this pull request Nov 6, 2024
…ility changes (#675)

**Issue:**
When building with GCC 4.8 and 4.9 and `-DBUILD_SHARED_LIBS=ON`, many tests were crashing. The crashes would say something like "free(): invalid pointer" and the stack trace would point into the c++ string headers.

**Things we tried**
- Crash stopped if we commented out the [recently-added line in CMakeLists.txt](https://github.com/awslabs/aws-crt-cpp/blob/80f4736126e14223a0c3882d3b734607143731f3/CMakeLists.txt#L305) line that sets `CXX_VISIBILITY_PRESET hidden`. So obviously symbol visibility has something to do with it.
- We tried adding adding `AWS_CRT_CPP_API` to the templated `StlAllocator` class (see edfed14), which stopped GCC 4.x from crashing, but then the [Windows compiler didn't like that](https://github.com/awslabs/aws-crt-cpp/actions/runs/11636848409/job/32409003392#step:2:2373).

**Description of Changes:** 
Don't set visibility to hidden for GCC < 5. That's how we had it before. GCC 4.x is very old. This isn't the first time it's disappointed us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants