nlfiedler / magick-rust

Rust bindings for ImageMagick
https://crates.io/crates/magick_rust
Apache License 2.0
254 stars 68 forks source link

Link Error 2019 unresolved external symbol SetMagickResourceLimit on Windows 11 MSVC #93

Closed wellitecho closed 2 years ago

wellitecho commented 2 years ago

build failed with Link Error 1120, with ImageMagick-7.0.11-Q16-HDRI on Windows 11.

full output:

error: linking with link.exe failed: exit code: 1120 | = note: "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\link.exe" "/NOLOGO" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.10v6bpuf3qi3s9wb.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.20wphgq7yzel1dvq.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.2d5b07kvx5m576z1.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.2di36doxcjpfqhw5.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.2f4aop8i2yt0inw5.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.2p5fjqh913yiwgks.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.31p0ky0plw70fawk.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.37wiekeicx5a4zch.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.3ny4vgohjuj6k767.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.3ovwk4tv7u8xbvdt.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.3uko6j6618irq2pg.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.45645ret6pyksr1q.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.4bvzjyulhnn9adq7.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.4oo73ps4klho4w2t.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.5b0bne1hskgc7naw.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.5f4bglcpf1imhpha.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.81a26skokhmwehw.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.za4p28hg9y16iqn.rcgu.o" "c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.1g45lxx20rdvqoa6.rcgu.o" "/LIBPATH:c:\Users\username\cargo_target_dir\debug\deps" "/LIBPATH:C:\Program Files\ImageMagick-7.0.11-Q16-HDRI\lib" "/LIBPATH:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "C:\Users\username\cargo_target_dir\debug\deps\libmagick_rust-eafa453c03e29a83.rlib" "C:\Users\username\cargo_target_dir\debug\deps\liblibc-bca145ffaa3cfaad.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-c2061a8c4363ad39.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libpanic_unwind-8f8123f3df81d084.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_demangle-b25b7b3cabf04f79.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd_detect-844c1d68b208e8c3.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libhashbrown-9715294e33005e45.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libminiz_oxide-ab777c9ef4ab46ea.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libadler-2163bb13d93657e2.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_alloc-a23614ca81dcf6e6.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libunwind-6a453694c0b8f4bc.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcfg_if-bafbc7d22d1290b3.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liblibc-b3f04308174fa2f6.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liballoc-9e7c4059b4444380.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_core-3469c9a2a5a61b94.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-5c32adea4bb22d70.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-c9e4ee006e473c58.rlib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "/OUT:c:\Users\username\cargo_target_dir\debug\deps\get_colorspace.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libstd.natvis" "-fuse-ld=lld" = note: Non-UTF-8 output: LINK : warning LNK4044: \xce\xde\xb7\xa8\xca\xb6\xb1\xf0\xb5\xc4\xd1\xa1\xcf\xee\xa1\xb0/fuse-ld=lld\xa1\xb1\xa3\xbb\xd2\xd1\xba\xf6\xc2\xd4\r\nlibmagick_rust-eafa453c03e29a83.rlib(magick_rust-eafa453c03e29a83.magick_rust.01cfdc8e-cgu.1.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 SetMagickResourceLimit\xa3\xac\xba\xaf\xca\xfd _ZN11magick_rust4wand6magick10MagickWand18set_resource_limit17h31d530d13a9f0a41E \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nc:\Users\username\cargo_target_dir\debug\deps\get_colorspace.exe : fatal error LNK1120: 1 \xb8\xf6\xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xc3\xfc\xc1\xee\r\n

warning: get_colorspace (bin "get_colorspace") generated 1 warning error: could not compile get_colorspace due to previous error; 1 warning emitted

So I decoded the last part of note with gbk encoding, which says something like:

libmagick_rust-eafa453c03e29a83.rlib(magick_rust-eafa453c03e29a83.magick_rust.01cfdc8e-cgu.1.rcgu.o) : error LNK2019: unresolved external symbol SetMagickResourceLimit,function _ZN11magick_rust4wand6magick10MagickWand18set_resource_limit17h31d530d13a9f0a41E refer to this sumbol\r\nc:\Users\username\cargo_target_dir\debug\deps\get_colorspace.exe : fatal error LNK1120: 1 unresolved external command\r\n

wellitecho commented 2 years ago

I see it's solved by commit f57de2e.