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

Objective-C Errors when building #183

Open
pnewell opened this issue Nov 19, 2024 · 1 comment
Open

Objective-C Errors when building #183

pnewell opened this issue Nov 19, 2024 · 1 comment

Comments

@pnewell
Copy link

pnewell commented Nov 19, 2024

I am getting a bunch of objective-c errors when trying to run make javakit-run (see below)

I am one an M3 MacBook Air.

This is java --version:

openjdk 23.0.1 2024-10-15
OpenJDK Runtime Environment (build 23.0.1+11-39)
OpenJDK 64-Bit Server VM (build 23.0.1+11-39, mixed mode, sharing)

Java was installed with brew (openjdk) and JAVA_HOME is pointed at /Users/REDACTED/Library/Java/JavaVirtualMachines/openjdk-23.0.1/Contents/Home

This is swift --version:

Apple Swift version 6.1-dev (LLVM c7635515f932833, Swift dbf388c0a58df0e)
Target: arm64-apple-macosx15.0

Here are the errors:

Writing Java class 'com.example.swift.HelloSubclass' translation to '/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/plugins/outputs/javakitsampleapp/JavaKitExample/destination/Java2SwiftPlugin/generated/HelloSubclass.swift'... done.
Writing Java class 'com.example.swift.JavaKitSampleMain' translation to '/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/plugins/outputs/javakitsampleapp/JavaKitExample/destination/Java2SwiftPlugin/generated/JavaKitSampleMain.swift'... done.
Writing Java class 'com.example.swift.HelloSwift' translation to '/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/plugins/outputs/javakitsampleapp/JavaKitExample/destination/Java2SwiftPlugin/generated/HelloSwift.swift'... done.
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

<unknown>:0: error: could not build Objective-C module 'SwiftShims'
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

<unknown>:0: error: could not build Objective-C module 'SwiftShims'
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

<unknown>:0: error: could not build Objective-C module 'SwiftShims'
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *
error: emit-module command failed with exit code 1 (use -v to see invocation)
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

<unknown>:0: error: could not build Objective-C module 'SwiftShims'
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

<unknown>:0: error: could not build Objective-C module 'SwiftShims'
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

<unknown>:0: error: could not build Objective-C module 'SwiftShims'
/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime-tool.build/module.modulemap:1:8: error: redefinition of module 'JavaRuntime'
1 | module JavaRuntime {
  |        `- error: redefinition of module 'JavaRuntime'
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

/Users/REDACTED/Downloads/swift-java-main/Samples/JavaKitSampleApp/.build/arm64-apple-macosx/debug/JavaRuntime.build/module.modulemap:1:8: note: previously defined here
1 | module JavaRuntime {
  |        `- note: previously defined here
2 |     umbrella header "/Users/REDACTED/Downloads/swift-java-main/Sources/JavaRuntime/include/JavaRuntime.h"
3 |     export *

make: *** [javakit-run] Error 1
@ktoso
Copy link
Collaborator

ktoso commented Nov 19, 2024

Hi there, thanks for trying out the project and sorry about the current state of the build, we're ironing out things and trying to get away make driving things.

Specifically for this sample, please follow the readme: https://github.com/swiftlang/swift-java?tab=readme-ov-file#javakit-swift---java

JavaKit (Swift -> Java)

To run a simple app showcasing a Swift process calling into a Java library you can run:

cd Samples/JavaKitSampleApp
swift build
java -cp .build/plugins/outputs/javakitsampleapp/JavaKitExample/destination/JavaCompilerPlugin/Java -Djava.library.path=.build/debug com.example.swift.JavaKitSampleMain

rather than rely on the make task; I'll remove the make task so it's not confusing folks anymore

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

2 participants