-
Notifications
You must be signed in to change notification settings - Fork 531
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
Trying to wrap the hurl library in flutter_rust_bridge for a package in flutter #3603
Comments
Hi, Seems like there is a linking issue with libxml (uses par Hurl). Could you verify in the logs that the command line builds include |
I don't know how it calls the build method but here are the detailed logs for you.
|
You should search for "how to link with libxml2 with Xcode", I don't know how to analyse these logs... |
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint hurl.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'hurl'
s.version = '0.0.1'
s.summary = 'A new Flutter FFI plugin project.'
s.description = <<-DESC
A new Flutter FFI plugin project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => '[email protected]' }
# This will ensure the source files in Classes/ are included in the native
# builds of apps using this FFI plugin. Podspec does not support relative
# paths, so Classes contains a forwarder C file that relatively imports
# `../src/*` so that the C sources can be shared among all target platforms.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'FlutterMacOS'
s.platform = :osx, '10.11'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.swift_version = '5.0'
s.script_phase = {
:name => 'Build Rust library',
# First argument is relative path to the `rust` folder, second is name of rust library
:script => 'sh "$PODS_TARGET_SRCROOT/../cargokit/build_pod.sh" ../rust hurl',
:execution_position => :before_compile,
:input_files => ['${BUILT_PRODUCTS_DIR}/cargokit_phony'],
# Let XCode know that the static library referenced in -force_load below is
# created by this build step.
:output_files => ["${BUILT_PRODUCTS_DIR}/libhurl.a"],
}
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
# Flutter.framework does not contain a i386 slice.
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386',
'OTHER_LDFLAGS' => '-force_load ${BUILT_PRODUCTS_DIR}/libhurl.a -lxml2',
}
end Need to add the -lxml2 in the OTHER_LDFLAGS now it compiles. Attached my podspec file if someone needs it. Thanks @jcamiel for the flag. |
https://crates.io/crates/libxml after banging my head with anything and everything this package doesn't support ios and android as far as I can tell by reading the code. build.rs fn main() {
if let Ok(ref s) = std::env::var("LIBXML2") {
// println!("{:?}", std::env::vars());
// panic!("set libxml2.");
let p = std::path::Path::new(s);
let fname = std::path::Path::new(p.file_name().expect("no file name in LIBXML2 env"));
assert!(p.is_file());
println!(
"cargo:rustc-link-lib={}",
fname
.file_stem()
.unwrap()
.to_string_lossy()
.strip_prefix("lib")
.unwrap()
);
println!(
"cargo:rustc-link-search={}",
p.parent()
.expect("no library path in LIBXML2 env")
.to_string_lossy()
);
} else {
#[cfg(any(target_family = "unix", target_os = "macos"))]
{
if pkg_config_dep::find() {
return;
}
}
#[cfg(windows)]
{
if vcpkg_dep::find() {
return;
}
}
panic!("Could not find libxml2.")
}
}
#[cfg(any(target_family = "unix", target_os = "macos"))]
mod pkg_config_dep {
pub fn find() -> bool {
if pkg_config::find_library("libxml-2.0").is_ok() {
return true;
}
false
}
}
#[cfg(target_family = "windows")]
mod vcpkg_dep {
pub fn find() -> bool {
if vcpkg::find_package("libxml2").is_ok() {
return true;
}
false
}
}
|
Hi, libxml itself should be available on iOS and Android via binding for these platforms. I can't help you with the rust crate libxml. We've chosen this dependency for various reason: great XPath support, XML SAX parser and battle proof library. |
Hi, |
No problem, no offense taken at all! I'm not at expert in iOS/Android but what I would do is to try to build something smaller, maybe just calling libxml though a flutter composant, then trying to build with libxml but with the Rust crate wrapper etc... |
The title but I am getting some issues while building it. If someone know how to solve this cryptic error.
What I am trying to do here:
Creating a library in dart by wrapping the rust hurl library with help of flutter_rust_bridge.
When I try to build this with xcode for macos.
The text was updated successfully, but these errors were encountered: