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

export-validator doesn't support macOS and Windows #920

Closed
devanlooches opened this issue Aug 5, 2022 · 12 comments
Closed

export-validator doesn't support macOS and Windows #920

devanlooches opened this issue Aug 5, 2022 · 12 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed topic: build Anything relating to the build system. type: development Work to ease development or maintenance, without direct effect on features or bugs

Comments

@devanlooches
Copy link
Contributor

Error:

cargo run -p export-validator
   Compiling remove_dir_all v0.5.3
   Compiling fastrand v1.8.0
   Compiling tempfile v3.3.0
   Compiling export-validator v0.1.0 (/Users/devan/Workspace/Fornjot/tools/export-validator)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "/var/folders/gk/_t6yht456mv08x6lpqygypx00000gn/T/rustcTiBDiV/symbols.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1231r3rw062mmh2d.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.12fjpzo0tfptdjx2.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.12fy4ilem562je78.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.12zjmyxu9olfljru.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.13jsjii9g9jyvlsv.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.154zky3afxmxbfh1.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.185r24yajoyqjkwo.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.187apyhwwjpd67rh.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1c9zscoqvjfjhzy8.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1dihppg9slfs0y2y.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1dqyhcjhfrrvfwv.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1fab21p06q157jew.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1fsllcvb9tox8cka.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1goxfy5wis8ishhm.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.1k05g471nbb2x5gq.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.2d27ifh3xpdzv0iz.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.2d6ljp3yg8bjwfio.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.2gr8694jqwh53zyi.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.2ko4vla39o8gdcw0.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.2q9f9ytqvqx3ld05.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.2vkxsztuwdd9prj0.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.368jdgp9o0wz5msu.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.38zu7526609pcha.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3asn5nvg91mfg6o2.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3jzd4m5icdguqgl0.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3ko6szsls2f25ekm.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3ndfy4qe6y02f62m.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3t2glgbkeo8r2nkg.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3t75to8c8k0i1kpz.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3zyf42dnevcf2yf1.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.41i7dm8n796pphey.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.48frywl45i6lqv5f.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.48mu6v5o8oscxjlm.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.48tyadli8xjretdu.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4am2ysoyqrh2xsov.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4e1hzafif90r9pbl.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4e623szoz6y74j2h.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4eqzbfu3zf2vc2j5.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4g2nijpv6m133zs5.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4gxwus2bjtf5x164.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4hn76v3jf6zxxaqj.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4jhhbh36c2npywbo.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4kj1vqi7ly6gx9bz.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4llvt873nvpkzlgu.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4mlo5n8wcfzqgl4h.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4oxzsxo94hvlcjh3.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4q2zuqn2dt95hwv2.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4s85le6xr8fhzwo9.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.4tbyiodh3wg2neb3.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.508k4v6nig6xo532.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.52dm076d64oti6bv.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.53u0klh9v3ohzhow.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.59s02wv2knnmpkhs.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.5b385hhvbv0f68y2.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.5f68yovt30g4pcl3.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.8x795sxxcmyamb7.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.byq9wo9xo3wp89l.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.d5oua6qgl55qesm.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.ge9o22slvci8gjd.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.ita385w0we2iyd5.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.jnz4r6o7v61limz.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.tb1hw3cvr8lkg6j.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.vapckrrqx2kjn49.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.vc4nvqbzjpsui0a.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.zp40bzsi7f127gx.rcgu.o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003.3jj6nluqb0ujzaij.rcgu.o" "-L" "/Users/devan/Workspace/Fornjot/target/debug/deps" "-L" "/Users/devan/Workspace/Fornjot/tools/export-validator/lib3mf/libs" "-L" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-l3mf" "/Users/devan/Workspace/Fornjot/target/debug/deps/libtempfile-dc917f1e56097537.rlib" "/Users/devan/Workspace/Fornjot/target/debug/deps/liblibc-6a29003711e39f17.rlib" "/Users/devan/Workspace/Fornjot/target/debug/deps/libcfg_if-e6fce2b47f1e3a40.rlib" "/Users/devan/Workspace/Fornjot/target/debug/deps/libfastrand-f74c0b19f076aa35.rlib" "/Users/devan/Workspace/Fornjot/target/debug/deps/libremove_dir_all-18d8f41122dc5eca.rlib" "/Users/devan/Workspace/Fornjot/target/debug/deps/libanyhow-d9580bbe45cb675a.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-10116371125a6aff.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-39e96d52875d1707.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-5291a2db2306cf06.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-390f7d5c905d1758.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-294943fd09f0dfee.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-5b8fe2191a96c1eb.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-6c345d2ae2af194e.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-7fb258730717fc35.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-95d7b07281459669.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-1830aefa1e824398.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libadler-6c20c3f29e08f382.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-392d2b6b8e347168.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-ed102691bd84ae29.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-f8a76297049f40d0.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-35af506aebbb3abd.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-e149d7d6ef6750c5.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-cdd7c9a0360e9a15.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-504c8436d3cdf687.rlib" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-68d0fd74539b07e1.rlib" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/devan/.rustup/toolchains/1.62.1-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/devan/Workspace/Fornjot/target/debug/deps/export_validator-419be965c839a003" "-Wl,-dead_strip" "-nodefaultlibs" "-Wl,-rpath,$ORIGIN/../../tools/export-validator/lib3mf/libs"
  = note: ld: warning: ignoring file /Users/devan/Workspace/Fornjot/tools/export-validator/lib3mf/libs/lib3mf.so, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
          Undefined symbols for architecture x86_64:
            "_lib3mf_createmodel", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_model_queryreader", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_reader_setstrictmodeactive", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_reader_readfromfile", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_reader_getwarningcount", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_model_getobjects", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_resourceiterator_movenext", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_objectiterator_getcurrentobject", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
            "_lib3mf_object_isvalid", referenced from:
                export_validator::validate_model::h547745ef40494711 in export_validator-419be965c839a003.4fzeh2yl7t8onpnm.rcgu.o
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `export-validator` due to previous error
error: Recipe `build` failed on line 8 with exit code 101
@hannobraun hannobraun added help wanted Extra attention is needed good first issue Good for newcomers type: development Work to ease development or maintenance, without direct effect on features or bugs topic: build Anything relating to the build system. labels Aug 6, 2022
@hannobraun
Copy link
Owner

Thank you, @devanlooches! What platform is that? Looks like macOS with Intel hardware?

export-validator relies of lib3mf, and I've added pre-compiled lib3mf libraries for the repository to support that. I just had a look, and it seems I only added the files for Linux, which is the only platform I can test.

To support export-validator on other platforms, we need the pre-compiled libraries for those too. Here: https://github.com/hannobraun/Fornjot/tree/main/tools/export-validator/lib3mf

That directory has a README that says where the files come from. Basically, we need to add the right files from the SDK, maybe necessary symlinks to make sure the linker finds them, and then possibly adapt export-validator's build.rs to make it work (maybe not, I don't know).

Any help doing that would be very appreciated! Labeling https://github.com/hannobraun/Fornjot/labels/help%20wanted, as I don't have access to the missing platforms. Also labeling https://github.com/hannobraun/Fornjot/labels/good%20first%20issue, as this is a build/linker issue that doesn't require any knowledge of Fornjot to figure out.

@hannobraun hannobraun changed the title just build fails on export-validator step export-validator doesn't support macOS and Windows Aug 6, 2022
@devanlooches
Copy link
Contributor Author

Sorry for not giving more info. You are correct I'm on a macOS with Intel hardware. I tried putting the files in the libs/ directory but I'm still getting the same error message.

@hannobraun
Copy link
Owner

Sorry for not giving more info. You are correct I'm on a macOS with Intel hardware. I tried putting the files in the libs/ directory but I'm still getting the same error message.

For Linux, I had to make sure that the file has a very specific name, hence the symbolic link there. This required some experimentation though, and I'm a bit out of my depth there, especially regarding macOS.

@hannobraun
Copy link
Owner

I just noticed @Michael-F-Bryan's lib3mf bindings. It seems it falls back to compiling lib3mf from source, if it can't find compiled binaries. Maybe using it could be the solution to this issue?

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented Sep 8, 2022

My original intention behind creating that lib3mf crate was actually so I could publish it to crates.io and switch Fornjot's validator over to it.

Unfortunately, I couldn't get Windows building reliably so I had to disable it in CI... Skimming through these build logs, I suspect it's an issue with their code and build system not being compatible with MSVC++. However, I hate debugging build systems for C/C++ projects so when I saw those errors and wasn't able to fix it easily, I threw the project in the too-hard basket and moved onto something else 😞

It works on MacOS, though!

Edit: Actually, thinking on this a bit more... Maybe I should create an issue and post it to the Call For Participation section in This Week In Rust.

@hannobraun
Copy link
Owner

Thanks for the info, @Michael-F-Bryan! Let's see how this shakes out.

I also didn't want to mess around with any C/C++ builds, which is why I decided to just check the library files into Git. Not a bad approach actually, I think.

@DengFX2010105421
Copy link

DengFX2010105421 commented Oct 12, 2022

from /Fornjot/tools/export-validator/lib3mf/README.md, just download lib3mf_sdk_v2.2.0.zip,unzip it, copy(overwrites needs maybe)lib files in /Bin to Fornjot/tools/export-validator/lib3mf/libs/, this issue resolved.

@hannobraun
Copy link
Owner

Thank you for looking into this, @DengFX2010105421! I'd appreciate a pull request. I'd prefer not to do it myself, since I can't test it.

@hannobraun
Copy link
Owner

I've come to the conclusion that it's a good idea to run the Export Validator for all platforms on the CI build, not just Linux. I tried to implement this today, using GitHub Actions as my test environment.

It was a huge pain, but I managed to do so for macOS here: #1226

I absolutely failed to get it working for Windows, and I don't understand what the problem is. It just won't work. Here's my work-in-progress: #1230

Any help figuring this out would be highly appreciated!

@Michael-F-Bryan
Copy link
Contributor

@hannobraun if you want, I'm more than happy to give you write access to my bindings repo.

@hannobraun
Copy link
Owner

Thanks, @Michael-F-Bryan, but I'd rather not. I've spent way too much time trying to link yesterday, and I have no intention to spend more time trying to compile 😄

What I'll do is, I'll replace this issue with a more specific one that summarizes the current situation and what's wrong, and try to get some help dealing with it. I hope there will be enough interest from Windows users to take care of this. If not, I can live without export-validator supporting Windows, for now.

@hannobraun
Copy link
Owner

Closing in favor of #1231.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed topic: build Anything relating to the build system. type: development Work to ease development or maintenance, without direct effect on features or bugs
Projects
None yet
Development

No branches or pull requests

4 participants