Symbolic Link Issue Extracting SDL2_mixer Tarball on Windows


#1

I posted the following question to superuser.com, but wanted to post it here for more exposure. The issue concerns the SDL2_mixer gzipped tarball:

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 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.