Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intermittent, random 'file not found' errors under Windows Subsystem for Linux (WSL)

Tags:

I'm getting intermitting 'fatal error: ... file not found' errors building C++ application using either gcc 4.8 or clang 3.8 under Ubuntu 16.04.2 running in Windows Subsystem for Linux (WSL), when including C++ header files, but only since installing the Windows 10 April update (Version 1803, OS Build 17134.1) a few days ago.

Example error message from clang compiler:

fatal error: 'boost/preprocessor/list/fold_left.hpp' file not found

Example error message from gcc compiler:

fatal error: boost/mpl/aux_/at_impl.hpp: No such file or directory

I say the error is intermittent because if I re-run the build, the particular error that interrupted the build disappears, and the build runs for a while longer until it either builds successfully or randomly fails to include some other file with the same kind of 'file not found' error.

The timing of this fault and the randomness of it make me suspect it is a new bug in WSL. Anyone else seeing this or have suggestions on how to fix it?

The error is not always in a Boost include, but often is simply because Boost comprises a large proportion of the overall include files. The files being built exist on a shared volume under /mnt/d/.

like image 950
Andrew Medlin Avatar asked May 07 '18 03:05

Andrew Medlin


People also ask

How do I fix the Windows Subsystem for Linux optional component is not enabled?

Installation issues. The Windows Subsystem for Linux optional component is not enabled: Open Control Panel -> Programs and Features -> Turn Windows Feature on or off -> Check Windows Subsystem for Linux or using the PowerShell cmdlet mentioned at the beginning of this article.

Is WSL working on Windows 11?

We saw in the tutorial Install Ubuntu WSL on Windows 10 that WSL can be installed from the command line. In Windows 11, it is also available directly from the Microsoft store as an application. Installation from the store will install the latest version of WSL with all the latest features.


1 Answers

This has been identified as a multithreading bug (https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-17655-skip-ahead) and should get fixed in a future windows update.

Since it's a multithreading bug, it might be possible to work around it by not using multithreaded builds.

If in a hurry, it might be possible to just get to the windows insider program and use one of the preview builds.

like image 76
Jari Komppa Avatar answered Oct 22 '22 22:10

Jari Komppa