-
Notifications
You must be signed in to change notification settings - Fork 39
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
Can't build crate as wasm target #115
Comments
I haven't seen any crates with native dependencies buildable in a wasm/browser environment. I'd be interested if there are any working examples of what that could look like. |
Clang does support building wasm32 as a target (I think?) and if not Clang then at least setting the C compiler to Emscripten should work, but I haven't got that to work either. |
|
Maybe relevant: ZSTD added support for
|
Another relevant link rustwasm/team#291 |
I spent a couple minutes trying to build for --- a/proj-sys/build.rs
+++ b/proj-sys/build.rs
@@ -88,6 +88,10 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
let mut archive = Archive::new(tar);
archive.unpack("PROJSRC/proj")?;
let mut config = cmake::Config::new("PROJSRC/proj/proj-8.1.0");
+ config.define("CMAKE_TRY_COMPILE_TARGET_TYPE", "STATIC_LIBRARY");
+ config.define("CMAKE_C_COMPILER_WORKS", "1");
+ config.define("CMAKE_CXX_COMPILER_WORKS", "1");
+ config.define("USE_THREAD", "0");
config.define("BUILD_SHARED_LIBS", "OFF");
config.define("BUILD_TESTING", "OFF");
config.define("BUILD_CCT", "OFF"); |
IMO That leaves When I run
I get
sqlite3 can be built to WASM via emscripten (see https://github.com/sql-js/sql.js). So the next step would be figuring out how to first build sqlite3 via emscripten then use that built sqlite3 to link to proj. Maybe relevant: https://emscripten.org/docs/compiling/Building-Projects.html#using-libraries |
There seems to be a Proj build for WASM: https://github.com/jvail/spl.js |
Has anyone had any luck compiling for WASM? |
Also a note that someone on this rust+wasm+c thread seems to have made an example repo for creating a wasm-pack build using targets other than |
Useful thread: rustwasm/team#291 |
The text was updated successfully, but these errors were encountered: