-2

I've inherited a GitHub job I don't understand well and that has stopped compiling.

It creates a .a library for iOS.

The source consists of a set of modules, each declared thus:

export module x;  
import y;  
using namespace nam_y;  
namespace nam_x  
{  
   export void x() {  
     do something  
   }  
}

compile.sh handles each module as below. This used to work, but now -fmodules-ts produces an error. Removing it produces many errors. I assume clang has been updated sometime this year? What syntax should I be using now?

This is the new error with fmodules-ts:

clang++: error: unknown argument: '-fmodules-ts'
$CXX -std=c++20 -fmodules-ts \
    -target "$TARGET" \
    -isysroot "$SDK_PATH" \
    -fprebuilt-module-path="$BUILD_DIR" \
    -x c++-module --precompile src/x.ixx -o build/x.pcm
New contributor
Imer Satz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • What version of clang are you using? Commented Nov 19 at 0:53
  • Have you tried dropping the flag that Clang doesn't recognize? C++20 supports modules.. fmodules-ts provides for an experimental version of module support... I doubt it is supported for C++20. Commented Nov 19 at 0:55

2 Answers 2

0

Delete the unrecognized flag ( e.g., -fmodules-ts )... C++20 provides support for modules natively. You don't need that flag if compiling with std=C++20, and its liekley that selecting C++20 means that -fmodules-ts is no longer a supported flag.

Sign up to request clarification or add additional context in comments.

3 Comments

The compile script I posted above worked perfectly until recently, using both c++20 and -fmodules flags. Dropping the flag produces these errors for each module: src/x.ixx:1:8: error: expected template 1 | export module x; | ^ src/x.ixx:1:8: error: unknown type name 'module' src/x.ixx:2:8: error: expected template 2 | export namespace nam_x | ^
What version of clang are you using? you can find it by clang --version
Let's not underestimate my ignorance: Am I correct that if I am using a GitHub runner to build this ios library, that it is Xcode's clang that is being used? I'm running a Windows PC and pushing everything to GitHub. The macOS is reported as 15.7.1 which appears to use clang 17. Do I have control over any of this?
0

If I specify


    runs-on: macos-14

in the workflow, I'm good if I continue to use the -fmodules-ts flag. Dunno when latest became 15 nor why that broke my code.

New contributor
Imer Satz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.