theos / sdks

Patched sdks that include private framework tbds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to compile C++ with latest toolchain and 14.7 SDK

sherrellbc opened this issue · comments

What are the steps to reproduce this issue?

  1. Create iPhone tool template
  2. Attempt to compile c++ code (replace main.m with main.cpp in Makefile)
#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}

What happens?

Compilation fails

What were you expecting to happen?

Successful compilation

Any logs, error output, etc?

$ make
> Making all for tool exampletool…
==> Compiling main.cpp (armv7)…
/opt/theos/sdks/iPhoneOS14.7.sdk/usr/include/c++/v1/module.modulemap:4:8: error: redefinition of module 'std_config'
module std_config [system] [extern_c] {
       ^
/opt/theos/toolchain/linux/iphone/bin/../include/c++/v1/module.modulemap:4:8: note: previously defined here
module std_config [system] [extern_c] {
       ^
/opt/theos/sdks/iPhoneOS14.7.sdk/usr/include/c++/v1/module.modulemap:8:8: error: redefinition of module 'std'
module std [system] {
       ^
/opt/theos/toolchain/linux/iphone/bin/../include/c++/v1/module.modulemap:8:8: note: previously defined here
module std [system] {
       ^
...

==> Compiling main.cpp (arm64)…
/opt/theos/sdks/iPhoneOS14.7.sdk/usr/include/c++/v1/module.modulemap:4:8: error: redefinition of module 'std_config'
module std_config [system] [extern_c] {
       ^
/opt/theos/toolchain/linux/iphone/bin/../include/c++/v1/module.modulemap:4:8: note: previously defined here
module std_config [system] [extern_c] {
       ^
/opt/theos/sdks/iPhoneOS14.7.sdk/usr/include/c++/v1/module.modulemap:8:8: error: redefinition of module 'std'
module std [system] {
       ^
...

What versions of software are you using?

Operating System: Linux/Ubuntu 18.04

Toolchain Version: latest (non-swift) from instructions

SDK Version: 14.7 (generated by using the provided sdk create script)

Sorry, I updated the output to reflect use of the 14.7 SDK I generated using create_patched_sdk.sh.

It seems that the 14.4 SDK available from the repo will compile this code just fine. Interestingly, there is no $SDK/usr/include/c++ directory in the 14.4 SDK as provided by the repo. But there is one in the 14.7 SDK generated by the script (and in the SDK sources). The toolchain provides its own c++ directory at $TOOLCHAIN/include/c++

THEOS is the latest from master as of last week sometime. Same for the create SDK script I linked.

Fixed with fd931ca