4

I am having an issue with extracting this gzipped tarball (direct link) on Windows platform. The problem is that the tarball contains symbolic links & the Windows platform (tar utility I have on the Windows platform) does not know how to handle them.

I am using GNU Tar under the the MSYS2/MinGW-w64 environment. Extracting the archive results in the following error message:

$ tar -xf SDL2_mixer-2.0.4.tar.gz
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/OpusFile.framework/Resources: Cannot create symlink to ‘Versions/Current/Resources’: No such file or directory

tar: SDL2_mixer-2.0.4/Xcode/Frameworks/OpusFile.framework/Headers: Cannot create symlink to ‘Versions/Current/Headers’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/OpusFile.framework/OpusFile: Cannot create symlink to ‘Versions/Current/OpusFile’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Vorbis.framework/Vorbis: Cannot create symlink to ‘Versions/Current/Vorbis’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Vorbis.framework/Resources: Cannot create symlink to ‘Versions/Current/Resources’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Vorbis.framework/Headers: Cannot create symlink to ‘Versions/Current/Headers’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Ogg.framework/Ogg: Cannot create symlink to ‘Versions/Current/Ogg’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Ogg.framework/Resources: Cannot create symlink to ‘Versions/Current/Resources’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Ogg.framework/Headers: Cannot create symlink to ‘Versions/Current/Headers’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/modplug.framework/modplug: Cannot create symlink to ‘Versions/Current/modplug’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/modplug.framework/Resources: Cannot create symlink to ‘Versions/Current/Resources’: No such file or directory tar: SDL2_mixer-2.0.4/Xcode/Frameworks/modplug.framework/Headers: Cannot create symlink to ‘Versions/Current/Headers’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/mpg123.framework/mpg123: Cannot create symlink to ‘Versions/Current/mpg123’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/mpg123.framework/Resources: Cannot create symlink to ‘Versions/Current/Resources’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/mpg123.framework/Headers: Cannot create symlink to ‘Versions/Current/Headers’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/FLAC.framework/Resources: Cannot create symlink to ‘Versions/Current/Resources’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/FLAC.framework/FLAC: Cannot create symlink to ‘Versions/Current/FLAC’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/FLAC.framework/Headers: Cannot create symlink to ‘Versions/Current/Headers’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Opus.framework/Opus: Cannot create symlink to ‘Versions/Current/Opus’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Opus.framework/Resources: Cannot create symlink to ‘Versions/Current/Resources’: No such file or directory
tar: SDL2_mixer-2.0.4/Xcode/Frameworks/Opus.framework/Headers: Cannot create symlink to ‘Versions/Current/Headers’: No such file or directory
tar: Exiting with failure status due to previous errors

$ echo $?
2

Because I am using this command in a script, the return value of the tar command dictates whether or not the script should exit in failure.

tar -xf SDL2_mixer-2.0.4.tar.gz
RET=$?
if test ${RET} -ne 0; then
    echo "An error occurred during extraction. Exiting ..."
    exit ${RET}
fi

GNU Tar has the -h|--dereference switch, but this is only for compressing, not extracting.

I can currently get around the issue by excluding the "Xcode" directory (which is only used on MacOS anyway, I believe) with the following command:

$ tar --exclude="SDL2_mixer-2.0.4/Xcode" -xf SDL2_mixer-2.0.4.tar.gz

But if there is a way to keep the "Xcode" directory intact & convert the symbolic links to regular files, I would prefer to do that.

Using 7zip to extract the tarball I receive a similar error:

$ "/c/Program Files/7-Zip/7z.exe" x -y SDL2_mixer-2.0.4.tar.gz
...

$ "/c/Program Files/7-Zip/7z.exe" x -y SDL2_mixer-2.0.4.tar
...
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\OpusFile.framework\Resources
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\OpusFile.framework\Headers
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\OpusFile.framework\OpusFile
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\OpusFile.framework\Versions\Current
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Vorbis.framework\Vorbis
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Vorbis.framework\Resources
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Vorbis.framework\Headers
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Vorbis.framework\Versions\Current
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Ogg.framework\Ogg
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Ogg.framework\Resources
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Ogg.framework\Headers
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Ogg.framework\Versions\Current
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\modplug.framework\modplug
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\modplug.framework\Resources
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\modplug.framework\Headers
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\modplug.framework\Versions\Current
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\mpg123.framework\mpg123
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\mpg123.framework\Resources
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\mpg123.framework\Headers
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\mpg123.framework\Versions\Current
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\FLAC.framework\Resources
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\FLAC.framework\FLAC
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\FLAC.framework\Headers
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\FLAC.framework\Versions\Current
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Opus.framework\Opus
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Opus.framework\Resources
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Opus.framework\Headers
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .\SDL2_mixer-2.0.4\Xcode\Frameworks\Opus.framework\Versions\Current
...

There is an alternative zip archive (direct link) that I could use instead, but tarballs are very common on non-Windows platforms & I would like to learn how to get past this issue for future reference.

Update: 2022-06-18

From the answer by jigwan & comment by Eric Gopak, it appears that 7-zip can handle converting the symbolic links using the built-in Windows mklink command. However, mklink requires elevated privileges or for developer mode to be enabled on the Windows system. This may not be a feasible solution for users without administrative privileges.

1 Answer 1

2

Windows can handle symbolic links just fine (see the mklink command). I have the same problem when I try to extract using GNU tar on Windows 10. However, 7-Zip can handle it just fine if I am running the terminal as Administrator (or run the 7-Zip GUI as Administrator).

$ /c/Program\ Files/7-Zip/7z.exe x SDL2_mixer-2.0.4.tar.gz
...

$ /c/Program\ Files/7-Zip/7z.exe x -oSDL2_mixer_7z/ SDL2_mixer-2.0.4.tar

7-Zip 18.06 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-12-30

Scanning the drive for archives:
1 file, 45209600 bytes (44 MiB)

Extracting archive: SDL2_mixer-2.0.4.tar
--
Path = SDL2_mixer-2.0.4.tar
Type = tar
Physical Size = 45209600
Headers Size = 1409536
Code Page = UTF-8

Everything is Ok

Folders: 283
Files: 2432
Size:       43182017
Compressed: 45209600
2
  • Thanks! Worked for me too! It makes sense that it requires running as Administrator, since mklink also requires the admin privileges
    – Eric Gopak
    Commented Mar 25, 2021 at 23:08
  • How can it be done without elevated privileges or enabling developer mode? Commented Jun 19, 2022 at 0:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .