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 finding the correct cplusplus compiler #23146

Open
wants to merge 3 commits into
base: blead
Choose a base branch
from

Conversation

bingos
Copy link
Contributor

@bingos bingos commented Mar 21, 2025

ExtUtils::CBuilder was using a slightly maverick method for finding the matching cplusplus compiler to the c compiler used to build perl.

On a Linux system with a perl built with the Oracle Developer cc cc='/opt/oracle/developerstudio12.6/bin/cc'

Errors were observed:
"c++: error: unrecognized command line option ‘-KPIC’; did you mean ‘-fPIC’?"

The cplusplus command for Oracle Developer suite is CC not c++ and the detection was picking up the system c++ (g++).

If there is a ccpath, the code should exhaust all the options and not fail through to using no path.

Clang/Clang++ were missing from the C/C++ mappings so I have added those as well.

bingos added 2 commits March 21, 2025 14:00
ExtUtils::CBuilder was using a slightly maverick method for
finding the matching cplusplus compiler to the c compiler
used to build perl.

On a Linux system with a perl built with the Oracle Developer cc
cc='/opt/oracle/developerstudio12.6/bin/cc'

Errors were observed:
"c++: error: unrecognized command line option ‘-KPIC’; did you mean ‘-fPIC’?"

The cplusplus command for Oracle Developer suite is CC not c++ and the
detection was picking up the system c++ (g++).

If there is a ccpath, the code should exhaust all the options and not fail
through to using no path.
@bingos bingos requested a review from Leont March 22, 2025 20:07
@jkeenan
Copy link
Contributor

jkeenan commented Mar 25, 2025

Are there any changes that could be added to CBuilder's test suite that would exercise these code changes?

if( can_run( $cxx1 ) ) {
$self->{config}{cxx} = $cxx1;
last;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation here doesn't match the rest of the file, and has added literal tabs mixed with the spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't actually change that from the original, the literal tab was there before. But let me fix that.

@bingos
Copy link
Contributor Author

bingos commented Mar 25, 2025

The test t/03-cpluscplus.t was the test that highlighted to me that the detection behaviour was wrong.

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