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

Address a clang compiler problem. #5328

Merged
merged 1 commit into from Jul 15, 2023
Merged

Conversation

bangerth
Copy link
Contributor

On @danieldouglas92 's laptop, the Levi-Civita variable introduced by @MFraters yesterday in #5318 leads to a linker error: It complains that there are duplicate copies of the variable in every object file. That's a compiler error: constexpr implies const, and const variables at namespace scope are automatically static, i.e. every .cc file that #includes the header file has its own copy with internal linkage. Apparently, clang does not know that rule.

As verified by @danieldouglas92, the problem can be worked around by explicitly marking the variable as static.

@bangerth
Copy link
Contributor Author

OK, let's try this again. @MFraters I had to turn this into a function -- I just can't figure out a combination of flags that works for both gcc and @danieldouglas92 's clang.

@bangerth bangerth force-pushed the static branch 2 times, most recently from 08f8e88 to d2a7ef4 Compare July 15, 2023 03:28
@bangerth
Copy link
Contributor Author

Perhaps now? Let's see what the tester says.

@bangerth
Copy link
Contributor Author

Hallelujah, it finally works!

@bobmyhill bobmyhill merged commit fa96061 into geodynamics:main Jul 15, 2023
6 checks passed
@bangerth bangerth deleted the static branch July 15, 2023 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants