WohlSoft / SDL-Mixer-X

SDL Mixer X (Or "MixerX" shortly) - An audio mixer library based on the SDL library, a fork of SDL_mixer
https://wohlsoft.github.io/SDL-Mixer-X/
Other
104 stars 26 forks source link

Trouble/help building on Windows (msys2-64bit) #21

Closed kcgen closed 5 years ago

kcgen commented 6 years ago

Steps to reproduce:

  1. Fresh Windows 7 / 10 installation or VM (Git for Windows is not installed)

  2. Download latest msys2 64-bit installer (http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe)

  3. Install to default path: c:\msys64

  4. Answer 'yes' to launch, within the bash terminal:

    1. pacman -Syu, when instructed close the terminal
    2. Reopen the terminal and run pacman -Su, wait till done
    3. Install dev stack: pacman -S --noconfirm p7zip upx zip unzip lzip git gcc cmake base-devel
  5. git clone --depth=1 https://github.com/WohlSoft/SDL-Mixer-X.git

  6. cd SDL-Mixer-X

  7. mkdir build && cd build

  8. cmake -DCMAKE_INSTALL_PREFIX=$HOME/local -DDOWNLOAD_AUDIO_CODECS_DEPENDENCY=YES ..

  9. make

Eventually fails here:

Performing download step (download, verify and extract) for 'SDL2HG'
-- File already exists but no hash specified (use URL_HASH):
  file='/home/kcroft/src/SDL-Mixer-X/build/external/AudioCodecs/src/AudioCodecs-build/external/SDL2/src/default.tar.bz2'
Old file will be removed and new file downloaded from URL.
-- Downloading...
   dst='/home/kcroft/src/SDL-Mixer-X/build/external/AudioCodecs/src/AudioCodecs-build/external/SDL2/src/default.tar.bz2'
   timeout='none'
-- Using src='https://hg.libsdl.org/SDL/archive/default.tar.bz2'
-- Downloading... done
-- extracting...
     src='/home/kcroft/src/SDL-Mixer-X/build/external/AudioCodecs/src/AudioCodecs-build/external/SDL2/src/default.tar.bz2'
     dst='/home/kcroft/src/SDL-Mixer-X/build/external/AudioCodecs/src/AudioCodecs-build/external/SDL2/src/SDL2HG'
-- extracting... [tar xfz]
CMake Error: Problem with archive_write_header(): Can't create 'SDL-default/android-project-ant/AndroidManifest.xml'
CMake Error: Current file: SDL-default/android-project-ant/AndroidManifest.xml
CMake Error: Problem extracting tar: /home/kcroft/src/SDL-Mixer-X/build/external/AudioCodecs/src/AudioCodecs-build/external/SDL2/src/default.tar.bz2
-- extracting... [error clean up]
CMake Error at SDL2HG-stamp/extract-SDL2HG.cmake:33 (message):
  error: extract of
  '/home/kcroft/src/SDL-Mixer-X/build/external/AudioCodecs/src/AudioCodecs-build/external/SDL2/src/default.tar.bz2'
  failed

make[5]: *** [CMakeFiles/SDL2HG.dir/build.make:92: external/SDL2/src/SDL2HG-stamp/SDL2HG-download] Error 1
make[4]: *** [CMakeFiles/Makefile2:68: CMakeFiles/SDL2HG.dir/all] Error 2
make[3]: *** [Makefile:130: all] Error 2
make[2]: *** [CMakeFiles/AudioCodecs.dir/build.make:111: external/AudioCodecs/src/AudioCodecs-stamp/AudioCodecs-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/AudioCodecs.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Wohlstand commented 6 years ago

To point the build place, use CMAKE_PREFIX_PATH where CMake will look for compiler, libraries, and packages. The Install prefix is the install destination to install.

kcgen commented 6 years ago

The msys2 package-provided cmake 3.10.x hits and issue extracting the tarball: cmake -E tar xfz default.tar.bz2 produces:

CMake Error: Problem with archive_write_header(): Can't create 'SDL-default/android-project-ant/AndroidManifest.xml'
CMake Error: Current file: SDL-default/android-project-ant/AndroidManifest.xml
CMake Error: Problem extracting tar: default.tar.bz2

It does seem to extract all the other files without issue though.

Using tar directly: tar jxf default.tar.bz2 extracts it without issue.

I added this direct-tar command to extract-SDLHG.cmake instead of cmake -E tar, however cmake promptly overwrote my changes on the next build attempt. I tried finding the code pattern outside of my build area, however it doesn't exist! I'm not sure where or how cmake is restoring the content of these cmake files.

Perhaps msys2's build of cmake has problems.. so I uninstalled it pacman -R cmake, fetched the latest cmake source, however it bombs out during bootstrap with conflicting function definitions (which was reported in 2012 also under mingw - however a cmake developer dismissed it as an issue), and the errors continues after correcting that. So I thew in the towel there.

I then tried mixing cmake's native Windows MSI installer within my msys2 bash environment - however it fails to detect even the c-compiler (even with -DMAKE_PREFIX_PATH= pointing to the msys2 binaries); it seems mixing the two worlds of windows paths and bash/linux paths cause quite a mess.

So I'm back to trying the direct tar approach, as a kludge. Any pointers you can give on how I can call tar directly (and not have cmake clobber my edits) would be a huge help!

Regards, Kevin

Wohlstand commented 6 years ago

-DMAKE_PREFIX_PATH=

Incorrect! It must be -DCMAKE_PREFIX_PATH=

kcgen commented 6 years ago

Thanks it was a typo in my comment above. I did try -DCMAKE_PREFIX_PATH= (various paths to the binaries), but it doesn't help.

Can you compile SDL-Mixer-X with msys2? https://www.msys2.org/

The exactly problem is due to extract-SDL2HG.cmake failing during extraction:

execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz ${filename}
Wohlstand commented 6 years ago

The only question why SDL thinks it's Android? If you are targeting to Windows platform, why SDL2 is trying to be built for Android? If you are trying to build it for Android, lemme apply a change from PGE Project where I made build via autotools of SDL2 on Haiku and on Android due those platforms are incomplete on CMake side.

Wohlstand commented 6 years ago

P.S. To extract bz2 you need to install bzip2

Wohlstand commented 6 years ago

When I'll come to my home, I'll try to check out the stuff on my Windows VM...

kcgen commented 6 years ago

the extraction happens to fail on a file in the Android directory (nothing to do with SDL targeting android).

kcgen commented 6 years ago

To extract bz2 you need to install bzip2

Actually, you don't when using the ExternalProject_Add function: https://github.com/WohlSoft/AudioCodecs/blob/f308a2c49c87f19cb6d0ce81756d36fb3e2549b7/download_sdl2_hg.cmake#L26

Cmake has it's own internal code to handle tar and zip files itself. Cmake does not call tar, bzip2, gunzip, or unzip from the shell or the PATH.

However, in this case, Cmake's internal tar handling code is not able to correctly processinf the tarball.

Wohlstand commented 6 years ago

Anyway, on my end CMake had no issues with bz2 on Windows... (and I'm able to compile under any of compiler I can choose on my system: Vanilla MinGW, MinGW-w64 (both 32bit and 64-bit), and even MSVC crap of any version) Maybe, because I using the official installer? Which CMake version you have on your end?

EDIT: Okay, 3.10 I see in your previous posts...

Wohlstand commented 6 years ago

Also, please try Mercirual's GZ: https://hg.libsdl.org/SDL/archive/default.tar.gz it's same as BZ2, but the reason why I choosen BZ2 is better compression level and faster download speed (a help for users who are having slower speed, but also the help for CIs are downloading anything from external resources slower than would be).

kcgen commented 6 years ago

Interesting - I didn't realize they had a tar.gz. Will give it a try and let you know.

kcgen commented 6 years ago

Darn - same problem.

$ cmake --version
cmake version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ wget https://hg.libsdl.org/SDL/archive/default.tar.gz
--2018-09-03 12:46:12--  https://hg.libsdl.org/SDL/archive/default.tar.gz
Resolving hg.libsdl.org (hg.libsdl.org)... 192.241.223.99, 2604:a880:1:20::181:e001
Connecting to hg.libsdl.org (hg.libsdl.org)|192.241.223.99|:443... connected.
HTTP request sent, awaiting response... 200 Script output follows
Length: unspecified [application/x-gzip]
Saving to: ‘default.tar.gz’
2018-09-03 12:46:19 (861 KB/s) - ‘default.tar.gz’ saved [5287934]
$ cmake -E tar zxf default.tar.gz
CMake Error: Problem with archive_write_header(): Can't create 'SDL-default/android-project-ant/AndroidManifest.xml'
CMake Error: Current file: SDL-default/android-project-ant/AndroidManifest.xml
CMake Error: Problem extracting tar: default.tar.gz
Wohlstand commented 6 years ago

Please try cmake -E tar -xf default.tar.gz without specifying of z (same with bz too)

kcgen commented 6 years ago
user@DESKTOP-OQOUQPI MSYS ~/src/SDL-Mixer-X/build
$ cmake -E tar -xf default.tar.gz
CMake Error: Problem with archive_write_header(): Can't create 'SDL-default/android-project-ant/AndroidManifest.xml'
CMake Error: Current file: SDL-default/android-project-ant/AndroidManifest.xml
CMake Error: Problem extracting tar: default.tar.gz
kcgen commented 6 years ago

I also tried the zip file, and same problem.

$ cmake -E tar -xvf default.zip
x SDL-default/.hg_archival.txt
x SDL-default/.hgignore
x SDL-default/.hgtags
x SDL-default/Android.mk
x SDL-default/BUGS.txt
x SDL-default/CMakeLists.txt
x SDL-default/COPYING.txt
x SDL-default/CREDITS.txt
x SDL-default/INSTALL.txt
x SDL-default/Makefile.in
x SDL-default/Makefile.minimal
x SDL-default/Makefile.pandora
x SDL-default/Makefile.psp
x SDL-default/Makefile.wiz
x SDL-default/README-SDL.txt
x SDL-default/README.txt
x SDL-default/SDL2.spec.in
x SDL-default/SDL2Config.cmake
x SDL-default/TODO.txt
x SDL-default/VisualC-WinRT/SDL2-WinRT.nuspec
x SDL-default/VisualC-WinRT/SDL2-WinRT.targets
x SDL-default/VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec
x SDL-default/VisualC-WinRT/SDL2main-WinRT-NonXAML.targets
x SDL-default/VisualC-WinRT/UWP_VS2015/SDL-UWP.sln
x SDL-default/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
x SDL-default/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
x SDL-default/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.sln
x SDL-default/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
x SDL-default/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
x SDL-default/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.sln
x SDL-default/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
x SDL-default/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
x SDL-default/VisualC-WinRT/tests/loopwave/Assets/Logo.png
x SDL-default/VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png
x SDL-default/VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png
x SDL-default/VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png
x SDL-default/VisualC-WinRT/tests/loopwave/Package.appxmanifest
x SDL-default/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj
x SDL-default/VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx
x SDL-default/VisualC-WinRT/tests/testthread/Assets/Logo.png
x SDL-default/VisualC-WinRT/tests/testthread/Assets/SmallLogo.png
x SDL-default/VisualC-WinRT/tests/testthread/Assets/SplashScreen.png
x SDL-default/VisualC-WinRT/tests/testthread/Assets/StoreLogo.png
x SDL-default/VisualC-WinRT/tests/testthread/Package.appxmanifest
x SDL-default/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj
x SDL-default/VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx
x SDL-default/VisualC.html
x SDL-default/VisualC/SDL.sln
x SDL-default/VisualC/SDL/SDL.vcxproj
x SDL-default/VisualC/SDL/SDL.vcxproj.filters
x SDL-default/VisualC/SDLmain/SDLmain.vcxproj
x SDL-default/VisualC/SDLtest/SDLtest.vcxproj
x SDL-default/VisualC/clean.sh
x SDL-default/VisualC/tests/checkkeys/checkkeys.vcxproj
x SDL-default/VisualC/tests/controllermap/controllermap.vcxproj
x SDL-default/VisualC/tests/loopwave/loopwave.vcxproj
x SDL-default/VisualC/tests/testatomic/testatomic.vcxproj
x SDL-default/VisualC/tests/testautomation/testautomation.vcxproj
x SDL-default/VisualC/tests/testdraw2/testdraw2.vcxproj
x SDL-default/VisualC/tests/testfile/testfile.vcxproj
x SDL-default/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj
x SDL-default/VisualC/tests/testgesture/testgesture.vcxproj
x SDL-default/VisualC/tests/testgl2/testgl2.vcxproj
x SDL-default/VisualC/tests/testgles2/testgles2.vcxproj
x SDL-default/VisualC/tests/testjoystick/testjoystick.vcxproj
x SDL-default/VisualC/tests/testoverlay2/testoverlay2.vcxproj
x SDL-default/VisualC/tests/testplatform/testplatform.vcxproj
x SDL-default/VisualC/tests/testpower/testpower.vcxproj
x SDL-default/VisualC/tests/testrendertarget/testrendertarget.vcxproj
x SDL-default/VisualC/tests/testrumble/testrumble.vcxproj
x SDL-default/VisualC/tests/testscale/testscale.vcxproj
x SDL-default/VisualC/tests/testshape/testshape.vcxproj
x SDL-default/VisualC/tests/testsprite2/testsprite2.vcxproj
x SDL-default/VisualC/tests/testvulkan/testvulkan.vcxproj
x SDL-default/VisualC/tests/testyuv/testyuv.vcxproj
x SDL-default/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj
x SDL-default/VisualC/visualtest/visualtest_VS2012.vcxproj
x SDL-default/WhatsNew.txt
x SDL-default/Xcode-iOS/Demos/Default.png
x SDL-default/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj
x SDL-default/Xcode-iOS/Demos/Icon.png
x SDL-default/Xcode-iOS/Demos/Info.plist
x SDL-default/Xcode-iOS/Demos/README
x SDL-default/Xcode-iOS/Demos/data/bitmapfont/kromasky_16x16.bmp
x SDL-default/Xcode-iOS/Demos/data/bitmapfont/license.txt
x SDL-default/Xcode-iOS/Demos/data/drums/ds_brush_snare.wav
x SDL-default/Xcode-iOS/Demos/data/drums/ds_china.wav
x SDL-default/Xcode-iOS/Demos/data/drums/ds_kick_big_amb.wav
x SDL-default/Xcode-iOS/Demos/data/drums/ds_loose_skin_mute.wav
x SDL-default/Xcode-iOS/Demos/data/icon.bmp
x SDL-default/Xcode-iOS/Demos/data/ship.bmp
x SDL-default/Xcode-iOS/Demos/data/space.bmp
x SDL-default/Xcode-iOS/Demos/data/stroke.bmp
x SDL-default/Xcode-iOS/Demos/iOS Launch Screen.storyboard
x SDL-default/Xcode-iOS/Demos/src/accelerometer.c
x SDL-default/Xcode-iOS/Demos/src/common.c
x SDL-default/Xcode-iOS/Demos/src/common.h
x SDL-default/Xcode-iOS/Demos/src/fireworks.c
x SDL-default/Xcode-iOS/Demos/src/happy.c
x SDL-default/Xcode-iOS/Demos/src/keyboard.c
x SDL-default/Xcode-iOS/Demos/src/mixer.c
x SDL-default/Xcode-iOS/Demos/src/rectangles.c
x SDL-default/Xcode-iOS/Demos/src/touch.c
x SDL-default/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
x SDL-default/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj
x SDL-default/Xcode-iOS/Template/SDL iOS Application/Default-568h@2x.png
x SDL-default/Xcode-iOS/Template/SDL iOS Application/Default.png
x SDL-default/Xcode-iOS/Template/SDL iOS Application/Icon.png
x SDL-default/Xcode-iOS/Template/SDL iOS Application/Info.plist
x SDL-default/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
x SDL-default/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateInfo.plist
x SDL-default/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj
x SDL-default/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.xcworkspace/contents.xcworkspacedata
x SDL-default/Xcode-iOS/Template/SDL iOS Application/main.c
x SDL-default/Xcode-iOS/Test/Info.plist
x SDL-default/Xcode-iOS/Test/README
x SDL-default/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj
x SDL-default/Xcode/SDL/Info-Framework.plist
x SDL-default/Xcode/SDL/SDL.xcodeproj/project.pbxproj
x SDL-default/Xcode/SDL/pkg-support/SDL.info
x SDL-default/Xcode/SDL/pkg-support/resources/License.txt
x SDL-default/Xcode/SDL/pkg-support/resources/ReadMe.txt
x SDL-default/Xcode/SDL/pkg-support/resources/SDL_DS_Store
x SDL-default/Xcode/SDL/pkg-support/sdl_logo.pdf
x SDL-default/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj
x SDL-default/Xcode/SDLTest/TestDropFile-Info.plist
x SDL-default/Xcode/XcodeDocSet/Doxyfile
x SDL-default/acinclude/ac_check_define.m4
x SDL-default/acinclude/alsa.m4
x SDL-default/acinclude/ax_check_compiler_flags.m4
x SDL-default/acinclude/ax_gcc_archflag.m4
x SDL-default/acinclude/ax_gcc_x86_cpuid.m4.htm
x SDL-default/acinclude/esd.m4
x SDL-default/acinclude/libtool.m4
x SDL-default/acinclude/ltoptions.m4
x SDL-default/acinclude/ltsugar.m4
x SDL-default/acinclude/ltversion.m4
x SDL-default/acinclude/lt~obsolete.m4
x SDL-default/android-project-ant/AndroidManifest.xml
CMake Error: Problem with archive_write_header(): Can't create 'SDL-default/android-project-ant/AndroidManifest.xml'
CMake Error: Current file: SDL-default/android-project-ant/AndroidManifest.xml
CMake Error: Problem extracting tar: default.zip
Wohlstand commented 6 years ago

This thing looks weird...

Wohlstand commented 6 years ago

Oh! I know why!!! It's a symbolic link!! https://hg.libsdl.org/SDL/file/26a817fe1b07/android-project-ant/AndroidManifest.xml

Wohlstand commented 6 years ago

Windows system is always sucked with symbolic links and no way to use them with no admin rights, that sucks...

Wohlstand commented 6 years ago

Anyway, gotta to report this to SDL2 team...

kcgen commented 6 years ago

Yup. Looks like cmake fails to handle symlinks properly.

They worked on the bug back in 3.6: https://cmake.org/Bug/view.php?id=13251

Then in 3.8: https://gitlab.kitware.com/cmake/cmake/issues/16741

Then it's resurfaced again in 3.10, reported 3 weeks ago: https://gitlab.kitware.com/physiology/engine/issues/9

Appears to depend on how cmake is compiled, if it uses its internal libarchive or external. Argh.. what a mess.

The problem is, we can't control how CMAKE extracts the archive; it always generates it's own cmake -E tar zxf <file> command, and doesn't let us use tar natively.

Wohlstand commented 6 years ago

Report I have sent: https://bugzilla.libsdl.org/show_bug.cgi?id=4248

kcgen commented 6 years ago

Excellent!

Wohlstand commented 6 years ago

Try the build now, I hope it must be fine now!

Wohlstand commented 5 years ago

I'll close this issue because of idling, looks like everything is fine.

Wohlstand commented 5 years ago

Okay, after long time, Ryan C. Gordon have explained me it's the problem of CMake itself (some of it's versions) which are having the bug: https://bugzilla.libsdl.org/show_bug.cgi?id=4248

Please, try to untar the archive via tar rather cmake -E tar for just in a case.