Opened 12 years ago

Last modified 8 years ago

#4153 new Bugs

Add symlink support for bjam on Windows

Reported by: Sorin Sbarnea <sorin.sbarnea@…> Owned by: Vladimir Prus
Milestone: Boost 1.43.0 Component: build
Version: Boost 1.42.0 Severity: Problem
Keywords: symlink bjam Cc: macke@…

Description

Currently bjam does not supports symlinks under Windows and it does copy the files instead. This is doubling the required disk space for boost libraries (overhead of ~1.4GB).

Windows does supports several types of symlinks and hardlinks.

The problem is that there are several limitations that require to make a wise decision regarding implementation:

NT symlinks are limited to 32 per path so we cannot use them for libraries.

Instead we can create hardlinks because they do not have this limitation.

Now regarding hardlinks:

  • NTFS is required (not FAT32 support but this shouldn't be a real limitation in 2010). The same limitation would apply if you have FAT32 on Linux.
  • Hardlink can be created using two options: fsutil hardlink create (XP+, but requires Admin rights), or mklink /H (Vista+, requires 'Create symbolic link' privilege that by default is assigned to Administrators group.)

I could easily patch symlink.jab file to use mklink or fsutil but I don't know if the above limitation are a blocking issue for accepting the patch. If this is true what would be the requirements for adding this feature to bjam?

I'm not sure if I can check the current partition type and privileges using jam but I could easily check if mklink fails and fallback to copy.

Change History (5)

comment:1 by viboes, 12 years ago

Could we change this to Feature Request/Optimization?

comment:2 by yuryu@…, 12 years ago

On Windows 7, I tried to create a hardlink with mklink /H and it worked without administrators privilege(I don't know if it works on Vista).

CreateHardLink API doesn't require administrator privilege even on XP and works from 2000. Creating a small utility to make hardlinks would be a possible solution for older OSes?

Hardlinks work exactly like files, so there will be no compatibility problems.

Boost library is wasting hundreds of MBs on a Windows installation and this is not a minor issue.

comment:3 by Marcus Lindblom <macke@…>, 12 years ago

Cc: macke@… added

comment:4 by René Rivera, 12 years ago

Component: bjambuild
Owner: changed from René Rivera to Vladimir Prus

comment:5 by enelar@…, 8 years ago

Right now i am have reverse require, i could not build boost under FAT32(using with SSD). How to force it DOT NOT try using symlink?

Note: See TracTickets for help on using tickets.