Skip to content

Conversation

Ansariel
Copy link
Contributor

@Ansariel Ansariel commented Oct 14, 2025

With the update of APR to versoin 1.7.5., we have to deal with an erroneous check for the definition of __attribute__ added to the APR head file apr.h: The additional check for the definition of __has_attribute is nonsense as it is a C++ internal macro to check for the existance of certain attributes, however it has nothing to do with __attribute__ used in this context.

Since __attribute__ is not defined in MSVC, the modified, erroneous check now causes said definition becoming missing, resulting in a huge amount of "this declaration may not have extern 'C' linkage" errors within in MSVC.

This change utilizes CMake to patch the extracted APR header file, restoring the original version of the check.

@github-actions github-actions bot added the cmake label Oct 14, 2025
…1.7.5

With the update of APR to versoin 1.7.5., we have to deal with an erroneous check for the definition of __attribute__ added to the APR head file apr.h: The additional check for the definition of __has_attribute is nonsense as it is a C++ internal macro to check for the existance of certain attributes, however it has nothing to do with __attribute__ used in this context.

Since __attribute__ is not defined in MSVC, the modified, erroneous check now causes said definition becoming missing, resulting in a huge amount of "this declaration may not have extern 'C' linkage" errors within in MSVC.

This change utilizes CMake to patch the extracted APR header file, restoring the original version of the check.
@Ansariel Ansariel force-pushed the develop-apr-header-fix branch from 0391bbf to dba526f Compare October 14, 2025 13:15
@akleshchev akleshchev requested a review from marchcat October 16, 2025 15:09
Copy link
Contributor

@marchcat marchcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @Ansariel!

@akleshchev akleshchev merged commit 790c52f into secondlife:develop Oct 16, 2025
12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2025
@akleshchev
Copy link
Contributor

Thank you, merged!

@secondlife secondlife unlocked this conversation Oct 16, 2025
# Fix erroneous check for __attribute__ definition introduced with APR 1.7.5, causing lots of "this declaration may not have extern 'C' linkage" errors in VS
file(READ ${LIBS_PREBUILT_DIR}/include/apr-1/apr.h APR_HEADER_CONTENTS)
string(REPLACE "#if !(defined(__attribute__) || defined(__has_attribute))" "#if !defined(__attribute__)" APR_HEADER_CONTENTS "${APR_HEADER_CONTENTS}")
file(WRITE ${LIBS_PREBUILT_DIR}/include/apr-1/apr.h "${APR_HEADER_CONTENTS}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably should have been done in https://github.com/secondlife/3p-apr_suite/blob/main/build-cmd.sh

Fastest and easiest way for TPVs to get it fixed without having to wait an eternity for an updated 3p lib. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"this declaration may not have extern 'C' linkage" errors in MSVC

3 participants