Skip to content

CMake Build from NFS Mount on Windows (Cygwin)

Context

When your multiplatform code (Qt e.g.) needs to be built from Linux and Windows and your code resides on a Linux file server.
On the Windows machine Cygwin is installed, and git from it is used by CMake to download third party libraries.
There are two options available for Windows to access these resources:

  • Samba
  • NFS

For some reason a 'Samba' gets its uid and gid wrong which git has some problems with the download third party libraries. NFS has no such problem.

Install NFS

NFS needs to be manually installed on a Windows system.

# For Server
Install-WindowsFeature NFS-Client
# For Workstation
Enable-WindowsOptionalFeature -FeatureName ServicesForNFS-ClientOnly, ClientForNFS-Infrastructure -Online -NoRestart

Mounting NFS

An NFS mount can only be performed on a drive, not a directory. So to mount a directory, a symbolic link is needed using mklink command. The mklink command needs to be enabled for regular users.

Find the nfs exports using the showmount

showmount -e server-name-or-ip

Mount the NFS to the S: drive.

mount -o anon server-name-or-ip:/path/to/directory S:

Create a symbolic link in the Cygwin users home directory.

mklink /D %HOMEDRIVE%%HOMEPATH%\cygwin\source S:\
Note

Deleting a symlink in Windows is done using rmdir and not del which is confusing because in Linux a >symbolic link is considered a file and not a directory.