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

Build failure when linking DUB dependencies with long names #2538

Closed
mbierlee opened this issue Nov 27, 2022 · 3 comments
Closed

Build failure when linking DUB dependencies with long names #2538

mbierlee opened this issue Nov 27, 2022 · 3 comments

Comments

@mbierlee
Copy link

System information

  • dub version: DUB version 1.30.0, built on Nov 14 2022
  • OS Platform and distribution: Windows 10
  • compiler version DMD32 D Compiler v2.101.0-dirty

Bug Description

When adding a dub project with a very long name, a linker error occurs. In the following example it tries to build a dependency called poodinis-mirage-config-injector:

Build directory C:\Users\[..]\AppData\Local\dub\packages\poodinis-mirage-config-injector-1.0.1\poodinis-mirage-config-injector\.dub\build\library-debug-windows-x86_64-dmd_v2.101.0-dirty-AD9F674B70EEEA986AF59B29018C0DC50245C96E020D599F9A3615568E3B78BA\ is not writable. Falling back to direct build in the system's temp folder.
    Building poodinis-mirage-config-injector 1.0.1 [library]
    Building dublongpaths ~master: building configuration [application]
     Linking dublongpaths
lld-link: error: undefined symbol: _D8poodinis13valueinjector6mirage10loadConfigFOCQBu9container19DependencyContainerxAyaZv
>>> referenced by D:\Temp\dublongpaths\source\app.d:22
>>>               .dub\build\application-debug-windows-x86_64-dmd_v2.101.0-dirty-BEE0070E13F5C7E5928CD6E33EABF03EF415566C2C52A4FE23C21BB581FD23B2\dublongpaths.obj:(_Dmain)

lld-link: error: undefined symbol: _D8poodinis13valueinjector6mirage12__ModuleInfoZ
>>> referenced by .dub\build\application-debug-windows-x86_64-dmd_v2.101.0-dirty-BEE0070E13F5C7E5928CD6E33EABF03EF415566C2C52A4FE23C21BB581FD23B2\dublongpaths.obj:(_D3app12__ModuleInfoZ)
Error: linker exited with status 1
Error D:\DLang\dmd2\windows\bin\dmd.exe failed with exit code 1.

This is possibly related to issue #911. The dependency fails to compile so the linker fails to find the lib.

How to reproduce?

See project: dublongpaths.zip
Just dub run it.

@mbierlee
Copy link
Author

mbierlee commented Nov 27, 2022

The problem lies in the writeFile function in:

public void writeFile(NativePath path, const void[] buffer)

It fails to write the test file from:
if (!isWritableDir(target_path, true)) {

One possible fix it to prefix the path with \\?\. See also: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry

@mbierlee mbierlee changed the title Build failure when linking with DUB projects with long names Build failure when linking DUB dependencies with long names Nov 27, 2022
@mbierlee
Copy link
Author

mbierlee commented Nov 28, 2022

I have since renamed the project to be shorter. The attached example project might not work as-is anymore.

@WebFreak001
Copy link
Member

fixed by #2589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants