servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.52k stars 198 forks source link

Linking Error when building pathfinder_canvas with pf-text #554

Closed DraftedDev closed 1 month ago

DraftedDev commented 4 months ago

I get a very ugly Linking Error when trying to build pathfinder_canvas with the pf-text feature.

I use following dependencies:

pathfinder_color = { git = "https://github.com/servo/pathfinder.git" }
pathfinder_content = { git = "https://github.com/servo/pathfinder.git" }
pathfinder_resources = { git = "https://github.com/servo/pathfinder.git" }
pathfinder_renderer = { git = "https://github.com/servo/pathfinder.git" }
pathfinder_gpu = { git = "https://github.com/servo/pathfinder.git" }
pathfinder_canvas = { git = "https://github.com/servo/pathfinder.git", features = ["pf-text"] }
pathfinder_geometry = { git = "https://github.com/servo/pathfinder.git" }

I also use the patch described in #313 to avoid another error:

[patch.crates-io]
pathfinder_gpu = { git = "https://github.com/servo/pathfinder" }
pathfinder_content = { git = "https://github.com/servo/pathfinder" }
pathfinder_color = { git = "https://github.com/servo/pathfinder" }
pathfinder_geometry = { git = "https://github.com/servo/pathfinder" }
pathfinder_renderer = { git = "https://github.com/servo/pathfinder" }
pathfinder_resources = { git = "https://github.com/servo/pathfinder" }
pathfinder_simd = { git = "https://github.com/servo/pathfinder" }

Maybe the bundled feature in the harfbuzz crate can fix this, but I don't think I can [patch] it with cargo.

Linker Error: LINK : fatal error LNK1181: cannot open input file 'harfbuzz.lib'.

See the full error here.


Thanks for any help 😄

nickspurry commented 1 month ago

I had a similar problem building the native demo and stumbled across this issue.

In my case, uninstalling MSYS2, running cargo clean then rebuilding solved the problem. Not sure if that will also work in your case.

I haven't investigated in much depth, but it looks like MSYS2 and MSVC linkers are interfering with each other somehow.

DraftedDev commented 1 month ago

I had a similar problem building the native demo and stumbled across this issue.

In my case, uninstalling MSYS2, running cargo clean then rebuilding solved the problem. Not sure if that will also work in your case.

I haven't investigated in much depth, but it looks like MSYS2 and MSVC linkers are interfering with each other somehow.

Thanks! That helped, though it's strange that this even happens at all.