Browse Source

sdk: guard wasm fns behind target_arch = "wasm32" to avoid dlopen errors on android for undefn symbols

darkfi 1 week ago
parent
commit
62efc1f13b

+ 1 - 1
src/contract/dao/src/lib.rs

@@ -52,7 +52,7 @@ pub mod error;
 /// Call parameters definitions
 pub mod model;
 
-#[cfg(not(feature = "no-entrypoint"))]
+#[cfg(all(not(feature = "no-entrypoint"), target_arch = "wasm32"))]
 /// WASM entrypoint functions
 pub mod entrypoint;
 

+ 1 - 1
src/contract/deployooor/src/lib.rs

@@ -40,7 +40,7 @@ impl TryFrom<u8> for DeployFunction {
     }
 }
 
-#[cfg(not(feature = "no-entrypoint"))]
+#[cfg(all(not(feature = "no-entrypoint"), target_arch = "wasm32"))]
 /// WASM entrypoint functions
 pub mod entrypoint;
 

+ 1 - 1
src/contract/money/src/lib.rs

@@ -63,7 +63,7 @@ pub mod error;
 /// Call parameters definitions
 pub mod model;
 
-#[cfg(not(feature = "no-entrypoint"))]
+#[cfg(all(not(feature = "no-entrypoint"), target_arch = "wasm32"))]
 /// WASM entrypoint functions
 pub mod entrypoint;
 

+ 1 - 1
src/sdk/src/crypto/smt/mod.rs

@@ -75,7 +75,7 @@ mod test;
 pub mod util;
 pub use util::Poseidon;
 
-#[cfg(feature = "wasm")]
+#[cfg(all(feature = "wasm", target_arch = "wasm32"))]
 pub mod wasmdb;
 
 // Bit size for Fp (and Fq)

+ 3 - 0
src/sdk/src/wasm/mod.rs

@@ -17,13 +17,16 @@
  */
 
 /// Database functions
+#[cfg(target_arch = "wasm32")]
 pub mod db;
 
 /// Entrypoint used for the wasm binaries
 pub mod entrypoint;
 
 /// Merkle
+#[cfg(target_arch = "wasm32")]
 pub mod merkle;
 
 /// Utility functions
+#[cfg(target_arch = "wasm32")]
 pub mod util;