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

[SR-15295] Cannot build main branch of SPM on Windows #4383

Closed
swift-ci opened this issue Oct 8, 2021 · 4 comments
Closed

[SR-15295] Cannot build main branch of SPM on Windows #4383

swift-ci opened this issue Oct 8, 2021 · 4 comments
Labels

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Oct 8, 2021

Previous ID SR-15295
Radar None
Original Reporter Beard (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee Beard (JIRA)
Priority Medium

md5: 152b8b78bef4b9b662b371991550dc65

Issue Description:

When I try to build on Windows, I get the following compile errors:

In file included from S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\Ninja\ManifestLoader.cpp:20:
 In file included from S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/MemoryBuffer.h:23:
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:165:3: error: unknown type name 'uid_t'
 {{ uid_t fs_st_uid = 0;}}
 {{ ^}}
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:166:3: error: unknown type name 'gid_t'
 {{ gid_t fs_st_gid = 0;}}
 {{ ^}}
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:187:21: error: unknown type name 'uid_t'
 {{ uid_t UID, gid_t GID, off_t Size)}}
 {{ ^}}
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:187:32: error: unknown type name 'gid_t'
 {{ uid_t UID, gid_t GID, off_t Size)}}
 {{ ^}}
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:252:3: error: unknown type name 'nlink_t'
 {{ nlink_t fs_st_nlinks = 0;}}
 {{ ^}}
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:267:55: error: unknown type name 'nlink_t'
 {{ file_status(file_type Type, perms Perms, dev_t Dev, nlink_t Links, ino_t Ino,}}
 {{ ^}}
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:270:15: error: unknown type name 'uid_t'
 {{ uid_t UID, gid_t GID, off_t Size)}}
 {{ ^}}
 S:\swift-package-manager\.build\checkouts\swift-llbuild\lib\llvm\Support\include\llvm/Support/FileSystem.h:270:26: error: unknown type name 'gid_t'
 {{ uid_t UID, gid_t GID, off_t Size)}}

When I look at the sources, I see this:

class basic_file_status {
protected:
 #if defined(LLVM_ON_UNIX)
 time_t fs_st_atime = 0;
 time_t fs_st_mtime = 0;
 uint32_t fs_st_atime_nsec = 0;
 uint32_t fs_st_mtime_nsec = 0;
 uid_t fs_st_uid = 0;
 gid_t fs_st_gid = 0;
 off_t fs_st_size = 0;
 #elif defined (_WIN32)

The first compilation error is just below the line:

#if defined(LLVM_ON_UNIX)
@swift-ci
Copy link
Contributor Author

swift-ci commented Oct 9, 2021

Comment by Patrick Beard (JIRA)

I noticed that LLVM_ON_UNIX is defined like this:

/* Define if this is Unixish platform */
#if !defined(LLVM_ON_WIN32)
#define LLVM_ON_UNIX 1
#endif

in .build/checkouts/swift-llbuild/utils/import-llvm/include/llvm/Config/llvm-config.h. So, I tried this build invocation:

swift build -v -Xcc -Wno-everything -Xcc -DLLVM_ON_WIN32=1

And it worked. Something in the build system needs to define this for the build to work automatically. Probably need to add this to the appropriate cxxSettings:

.define("LLVM_ON_WIN32", .when(platforms: [.windows])),

@swift-ci
Copy link
Contributor Author

swift-ci commented Oct 9, 2021

Comment by Patrick Beard (JIRA)

I have a fix for this. All that was needed was to add llbuildNinja to the list of targets that needed to define LLVM_ON_WIN32 like this:

target.cxxSettings = [ .define("LLVM_ON_WIN32", .when(platforms: [.windows])) ]

Fix is in apple/swift-llbuild#741

@swift-ci
Copy link
Contributor Author

Comment by Patrick Beard (JIRA)

This PR has been merged. This issue can be closed.

@swift-ci
Copy link
Contributor Author

swift-ci commented Nov 5, 2021

Comment by Patrick Beard (JIRA)

I landed a PR that fixes this issue.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant