Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

swiftwasm script fails for more than one swift file #1

Open
kverrier opened this issue Jun 12, 2019 · 3 comments
Open

swiftwasm script fails for more than one swift file #1

kverrier opened this issue Jun 12, 2019 · 3 comments

Comments

@kverrier
Copy link

Super cool project @zhuowei !

Ran into a little snag trying it out. Looks like the swiftwasm script doesn't support passing in multiple swift files and I get an error about an invalid module name.

$ ./swiftwasm file1.swift file2.swift output.wasm
<unknown>:0: error: module name "swiftwasm-XXXXXXXX" is not a valid identifier; use -module-name flag to specify an alternate name

Haven't look much further into the issue yet. I'll keep tinkering but would love any insights.

@kverrier kverrier changed the title swiftwasm script fails for more than one swift file swiftwasm script fails for more than one swift file Jun 12, 2019
@zhuowei
Copy link
Contributor

zhuowei commented Jun 13, 2019

@kverrier Thanks! Yeah, I haven't tested it with more than one file.

If you want to try, I think you can pass the module name override as the second-last parameter before the output.wasm parameter.

@kverrier
Copy link
Author

kverrier commented Jun 13, 2019

Thanks for the quick response!

No luck with that flag 😢 ... Looks like swiftc doesn't like -o when generating multiple files. Makes sense since this is outputting multiple object files:

$ ./swiftwasm file1.swift file2.swift -module-name "test" output.wasm
<unknown>:0: error: cannot specify -o when generating multiple output files

I'll experiment with a more traditional Makefile in a small project and report my findings.

@zhuowei
Copy link
Contributor

zhuowei commented Jun 13, 2019

@kverrier The swiftwasm script's main job is to set up the linker arguments - if you have those you should be ok.

(It's needed because we haven't added the right linker flags to swiftc yet, so it won't call wasm-ld for us)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants