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

How to compile a C++ program with clang from repo? #208

Closed
Officeyutong opened this issue Nov 23, 2020 · 6 comments
Closed

How to compile a C++ program with clang from repo? #208

Officeyutong opened this issue Nov 23, 2020 · 6 comments

Comments

@Officeyutong
Copy link

I have installed clang-10, libclang-common-10-dev, libclang-cpp10, libc++-10-dev and libc++-dev from the Procursus, but when I used clang-10 to compile a C++ program, it gives me the following errors:

YTs-iPad-Pro:~ root# cat test.cpp
#include <iostream>

using namespace std;

int main(){
        cout << "test" << endl;
        return 0;
}
YTs-iPad-Pro:~ root# clang-10 test.cpp
In file included from test.cpp:1:
In file included from /usr/bin/../include/c++/v1/iostream:37:
In file included from /usr/bin/../include/c++/v1/ios:214:
In file included from /usr/bin/../include/c++/v1/iosfwd:95:
/usr/bin/../include/c++/v1/wchar.h:118:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
              ^~~~~~~~~
1 error generated.
YTs-iPad-Pro:~ root# 

Does this mean that I have forgot to install some packages(such as a certain type of Standard C Libraries) ? or C++ programs are not supported now?

OS: iPadOS 13.5.1
Jailbreak: Odyssey 1.2
Device: iPad Pro 2020 11-inch
Package manager: Sileo

@Officeyutong Officeyutong changed the title How to compile a C++ program with clang in this repo? How to compile a C++ program with clang in from repo? Nov 23, 2020
@Officeyutong Officeyutong changed the title How to compile a C++ program with clang in from repo? How to compile a C++ program with clang from repo? Nov 23, 2020
@Diatrus
Copy link
Contributor

Diatrus commented Nov 23, 2020

Place an iPhoneOS sdk in /usr/share/SDKs, restart your terminal, and try again.

@CRKatri
Copy link
Member

CRKatri commented Nov 23, 2020

Also make sure build-essential is installed

@Officeyutong
Copy link
Author

Officeyutong commented Nov 24, 2020

Place an iPhoneOS sdk in /usr/share/SDKs, restart your terminal, and try again.

I copied the iPhoneOS sdk from the XCode , then another error occured

YTs-iPad-Pro:~ root# clang-10 test.cpp                                           
In file included from test.cpp:1:
In file included from /usr/bin/../include/c++/v1/iostream:37:
In file included from /usr/bin/../include/c++/v1/ios:214:
In file included from /usr/bin/../include/c++/v1/iosfwd:95:
In file included from /var/include/wchar.h:70:
/var/include/sys/cdefs.h:458:4: error: Unknown architecture
#  error Unknown architecture
   ^
In file included from test.cpp:1:
In file included from /usr/bin/../include/c++/v1/iostream:37:
In file included from /usr/bin/../include/c++/v1/ios:214:
In file included from /usr/bin/../include/c++/v1/iosfwd:95:
In file included from /var/include/wchar.h:71:
In file included from /var/include/_types.h:27:
In file included from /var/include/sys/_types.h:33:
/var/include/machine/_types.h:32:2: error: architecture not supported
#error architecture not supported
 ^
In file included from test.cpp:1:
In file included from /usr/bin/../include/c++/v1/iostream:37:
In file included from /usr/bin/../include/c++/v1/ios:214:
In file included from /usr/bin/../include/c++/v1/iosfwd:95:
In file included from /var/include/wchar.h:71:
In file included from /var/include/_types.h:27:
/var/include/sys/_types.h:94:9: error: unknown type name '__int64_t'
typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
        ^
/var/include/sys/_types.h:95:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
        ^
note: '__int128_t' declared here
/var/include/sys/_types.h:96:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_dev_t;         /* dev_t */
        ^
note: '__int128_t' declared here
/var/include/sys/_types.h:99:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
        ^
note: '__uint128_t' declared here
/var/include/sys/_types.h:100:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
        ^
note: '__uint128_t' declared here
/var/include/sys/_types.h:101:9: error: unknown type name '__uint64_t'
typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
        ^
/var/include/sys/_types.h:105:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_ino_t;         /* [???] Used for inodes */
        ^
note: '__uint128_t' declared here
/var/include/sys/_types.h:107:9: error: unknown type name '__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
        ^
/var/include/sys/_types.h:109:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?
typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
        ^
note: '__uint128_t' declared here
/var/include/sys/_types.h:110:9: error: unknown type name '__int64_t'
typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
        ^
/var/include/sys/_types.h:111:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
        ^
note: '__int128_t' declared here
/var/include/sys/_types.h:131:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
        ^
note: '__uint128_t' declared here
/var/include/sys/_types.h:132:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
        ^
note: '__int128_t' declared here
/var/include/sys/_types.h:133:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
        ^
note: '__uint128_t' declared here
/var/include/sys/_types.h:134:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
        ^
note: '__uint128_t' declared here
In file included from test.cpp:1:
In file included from /usr/bin/../include/c++/v1/iostream:37:
In file included from /usr/bin/../include/c++/v1/ios:214:
In file included from /usr/bin/../include/c++/v1/iosfwd:95:
In file included from /var/include/wchar.h:71:
/var/include/_types.h:32:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_wctype_t;
        ^
note: '__uint128_t' declared here
In file included from test.cpp:1:
In file included from /usr/bin/../include/c++/v1/iostream:37:
In file included from /usr/bin/../include/c++/v1/ios:214:
In file included from /usr/bin/../include/c++/v1/iosfwd:95:
/var/include/wchar.h:79:9: error: unknown type name '__darwin_size_t'
typedef __darwin_size_t         size_t;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

@Diatrus
Copy link
Contributor

Diatrus commented Nov 24, 2020

You need c++ headers from the Xcode toolchain, or install libc++-dev

EDIT: I just noticed the error was from /var/include/wchar.h, why is that there? lol

@CRKatri
Copy link
Member

CRKatri commented Nov 24, 2020

Besides the weird stuff that happened with /var that needs to be fixed you should also be running clang++ to compile.
Also make sure odcctools is installed.

@Officeyutong
Copy link
Author

You need c++ headers from the Xcode toolchain, or install libc++-dev

EDIT: I just noticed the error was from /var/include/wchar.h, why is that there? lol

I solved my problem by removing /var/include, thanks XD

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

No branches or pull requests

3 participants