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

C++20 R build #246

Closed
wants to merge 9 commits into from
Closed

C++20 R build #246

wants to merge 9 commits into from

Conversation

XanthosXanthopoulos
Copy link

@XanthosXanthopoulos XanthosXanthopoulos commented Jan 9, 2025

After switching to C++20 the R build failed with an cryptic memory error message during build (see #230). The culprit seems to be -fvisibility-inlines-hidden, where the build succeeds once the flag is removed. With C++17 there is no issue with that flag and I haven't succeeded in a local repro of the issue outside of a docker container.

Copy link
Collaborator

@jdblischak jdblischak left a comment

Choose a reason for hiding this comment

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

This is awesome @XanthosXanthopoulos! It's amazing to finally see some green CI for the C++20 builds

echo CC=$RECIPE_DIR/cc_wrap.sh > ~/.R/Makevars
echo CXX=$RECIPE_DIR/cxx_wrap.sh >> ~/.R/Makevars
echo CXX17=$RECIPE_DIR/cxx_wrap.sh >> ~/.R/Makevars
export CXX20=$RECIPE_DIR/cxx_wrap.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need to define CXX20 here when it is overwritten below?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I confirmed that this instance of CXX20 is not needed

@@ -1,4 +1,4 @@
#!/bin/sh

args="${@##-mmacosx-version-min=10.9*}"
$NN_CC_ORIG $args -mmacosx-version-min=11.0
args="${@##-mmacosx-version-min=13.3*}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think the version in these 2 lines shouldn't match. My understanding of the purpose of the wrapper script is to remove the original value of -mmacosx-version-min and replace it with a new one. If the script is replacing the exact same string, we can probably remove the wrapper script all-together.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I confirmed that the line args="${@##-mmacosx-version-min=13.3*}" doesn't do anything. That's why setting it to the same value that is being added makes no difference. I confirmed that the file can be simplified to:

#!/bin/sh

$NN_CC_ORIG "$@" -mmacosx-version-min=13.3

MACOSX_SDK_VERSION: # [osx and x86_64]
- 11.0 # [osx and x86_64]
MACOSX_SDK_VERSION: # [osx and x86_64]
- 13.3 # [osx and x86_64]
c_stdlib_version: # [osx and x86_64]
- 11.0 # [osx and x86_64]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was concerned that these didn't match, but I think this is correct. From the conda-forge docs, we don't need to bump c_stdlib_version as long as we're not getting additional errors.

@johnkerl
Copy link
Collaborator

@XanthosXanthopoulos my commits 7,8,9 are as noted in Slack

@johnkerl johnkerl marked this pull request as ready for review January 13, 2025 16:18
@johnkerl johnkerl requested a review from jdblischak January 13, 2025 16:18
@@ -2,6 +2,9 @@

set -exo pipefail

# Clear default compiler flags
export CXXFLAGS=${CXXFLAGS//"-fvisibility-inlines-hidden"/}
Copy link
Member

Choose a reason for hiding this comment

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

Where is the flag coming from?

Choose a reason for hiding this comment

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

@johnkerl johnkerl changed the title C++20 r-build C++20 R build Jan 14, 2025
Copy link
Collaborator

@jdblischak jdblischak left a comment

Choose a reason for hiding this comment

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

I have applied this C++20 patch to the nightly setup workflow in #253

echo CC=$RECIPE_DIR/cc_wrap.sh > ~/.R/Makevars
echo CXX=$RECIPE_DIR/cxx_wrap.sh >> ~/.R/Makevars
echo CXX17=$RECIPE_DIR/cxx_wrap.sh >> ~/.R/Makevars
export CXX20=$RECIPE_DIR/cxx_wrap.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

I confirmed that this instance of CXX20 is not needed

@@ -1,4 +1,4 @@
#!/bin/sh

args="${@##-mmacosx-version-min=10.9*}"
$NN_CC_ORIG $args -mmacosx-version-min=11.0
args="${@##-mmacosx-version-min=13.3*}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I confirmed that the line args="${@##-mmacosx-version-min=13.3*}" doesn't do anything. That's why setting it to the same value that is being added makes no difference. I confirmed that the file can be simplified to:

#!/bin/sh

$NN_CC_ORIG "$@" -mmacosx-version-min=13.3

@jdblischak
Copy link
Collaborator

This PR has served its purpose. When we release a version of SOMA that supports C++20, we'll need to apply these changes to that update PR. I want @XanthosXanthopoulos to get credit for this important contribution, so the following steps should preserve the author information:

# Apply patch to support C++20
patch -p1 < .github/scripts/nightly/cpp20.patch
# Add and commit
git commit -a -m "Support C++20" --author="XanthosXanthopoulos <[email protected]>"
# Remove my code to update the nightly builds
git revert 9462dca5141914c05d94624f3b98546223ec5a61

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.

4 participants