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

Unable to use swift-api-digester when aws-crt-swift is a dependency #267

Open
rozaychen opened this issue Jun 7, 2024 · 4 comments
Open
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@rozaychen
Copy link

Describe the bug

Hi!

I have aws-crt-swift as a dependency of my library (integrated with SPM). I'd like to use swift-api-digester to diagnose breaking API changes. I do this by running swift build and then swift api-digester. These are the commands I run:

swift build --target $module

swift api-digester -swift-only -sdk "$(xcrun --show-sdk-path)" -dump-sdk -module "$module" \
        -o "./api-dump/$module.json" -I .build/debug

The build command succeeds; however, the swift-api-digester fails with this error:

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/amplify-swift/.build/checkouts/aws-crt-swift/aws-common-runtime/aws-c-cal/include/aws/cal/cal.h"
        ^
/Users/rozayc/Downloads/amplify-swift/.build/checkouts/aws-crt-swift/aws-common-runtime/aws-c-cal/include/aws/cal/cal.h:8:10: error: 'aws/common/common.h' file not found
#include <aws/common/common.h>
         ^
<unknown>:0: error: could not build Objective-C module 'AwsCCal'
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/amplify-swift/.build/checkouts/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h"
        ^
Failed to load module: AWSCloudWatchLoggingPlugin

I tried to debug by running swift build then swift api-digester in aws-crt-swift, and I get this error:

rozayc@6c7e67cb160a Downloads % ./generate_api_files.sh 
warning: 'aws-crt-swift': Invalid Exclude '/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-io/THIRD-PARTY-LICENSES.txt': File not found.
Building for debugging...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build complete! (0.26s)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h"
        ^
/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h:9:10: error: 'aws/auth/exports.h' file not found
#include <aws/auth/exports.h>
         ^
<unknown>:0: error: could not build Objective-C module 'AwsCAuth'
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-cal/include/aws/cal/cal.h"
        ^
Failed to load module: AwsCommonRuntimeKit

Do you have any recommendations for how I might be able to solve this issue? Thanks!

Expected Behavior

Expected to generate json file in the api-dump folder when running swift api-digester

Current Behavior

Has the failed to load module error

Reproduction Steps

In the aws-crt-swift directory, run
swift build
Then run
swift api-digester -sdk "$(xcrun --show-sdk-path)" -dump-sdk -module "AwsCommonRuntimeKit" -o ./api-dump/AwsCommonRuntimeKit.json -I .build/debug

Possible Solution

No response

Additional Information/Context

No response

aws-crt-swift version used

0.26.0

Compiler and Version used

swift 5.9.0

Operating System and version

macos v14.4.1

@rozaychen rozaychen added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 7, 2024
@DmitriyMusatkin
Copy link
Contributor

make sure to do a recursive git clone when getting the code. looks like its not picking up submodules.

@waahm7 waahm7 added the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 5 days. label Jun 7, 2024
@rozaychen
Copy link
Author

I get the same error message after running swift package clean and git clone --recursive https://github.com/awslabs/aws-crt-swift.git. Seems like it's not problem with recursive git clone.

@DmitriyMusatkin
Copy link
Contributor

Can you try git clone --recurse-submodules https://github.com/awslabs/aws-crt-swift.git?

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 5 days. label Jun 8, 2024
@rozaychen
Copy link
Author

rozaychen commented Jun 8, 2024

I tried Running this command then api-digester, I also tried running git submodule update --init --recursive instead, but both commands doesn't change anything. I'm still getting

#import "/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h"
        ^
/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h:9:10: error: 'aws/auth/exports.h' file not found
#include <aws/auth/exports.h>
         ^
<unknown>:0: error: could not build Objective-C module 'AwsCAuth'
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-cal/include/aws/cal/cal.h"
        ^
Failed to load module: AwsCommonRuntimeKit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants