haskanoid icon indicating copy to clipboard operation
haskanoid copied to clipboard

Installation error on mac

Open nikivazou opened this issue 7 years ago • 11 comments

Following the below steps

$ cabal update
$ cabal sandbox init                # skip if you are using cabal-dev
$ cabal unpack haskanoid            # or git clone http://github.com/ivanperez-keera/haskanoid
$ cd haskanoid-*                    # Game resources are here
$ cabal install  -f-wiimote -f-kinect   
$ ./dist/build/haskanoid/haskanoid

errors with

Resolving dependencies...
Configuring SDL-0.6.5.1...
Failed to install SDL-0.6.5.1
Build log ( /Users/niki/.cabal/logs/ghc-8.0.2/SDL-0.6.5.1-KvB334CFAgc2g1XAOFu4La.log ):
cabal: Entering directory '/var/folders/g_/rh7h5cnx7nl5t_894q4gn58w0000gn/T/cabal-tmp-4710/SDL-0.6.5.1'
[1 of 1] Compiling Main             ( /var/folders/g_/rh7h5cnx7nl5t_894q4gn58w0000gn/T/cabal-tmp-4710/SDL-0.6.5.1/dist/setup/setup.hs, /var/folders/g_/rh7h5cnx7nl5t_894q4gn58w0000gn/T/cabal-tmp-4710/SDL-0.6.5.1/dist/setup/Main.o )
Linking /var/folders/g_/rh7h5cnx7nl5t_894q4gn58w0000gn/T/cabal-tmp-4710/SDL-0.6.5.1/dist/setup/setup ...
Configuring SDL-0.6.5.1...
configure: WARNING: unrecognized options: --with-compiler
checking for sdl-config... no
checking for sdl11-config... no
configure: error: *** SDL not found! Get SDL from www.libsdl.org.
If you already installed it, check it's in the path. If problem remains,
please send a mail to the address that appears in ./configure --version
indicating your platform, the version of configure script and the problem.
cabal: Leaving directory '/var/folders/g_/rh7h5cnx7nl5t_894q4gn58w0000gn/T/cabal-tmp-4710/SDL-0.6.5.1'
cabal: Error: some packages failed to install:
SDL-0.6.5.1-KvB334CFAgc2g1XAOFu4La failed during the configure step. The
exception was:
ExitFailure 1
SDL-image-0.6.1.2-pDi03sWFuc8kJwXw5DdPB depends on SDL-image-0.6.1.2 which
failed to install.
SDL-mixer-0.6.2.0-L1008IeMTiHBThc5g1Z1Nl depends on SDL-mixer-0.6.2.0 which
failed to install.
SDL-ttf-0.6.2.2-BxbtB9T5H8D1ZYMVeFPr3Y depends on SDL-ttf-0.6.2.2 which failed
to install.
haskanoid-0.1.5.2-Beb4t66NOkN9jrXt1oHxba depends on haskanoid-0.1.5.2 which
failed to install.

nikivazou avatar Sep 24 '17 23:09 nikivazou

I installed SDL, SDLimage etc with brew and when I run

>>= cabal install -f-wiimote --extra-include-dirs=/Users/niki/bin/homebrew/Cellar/sdl/1.2.15/include/ --extra-include-dirs=/Users/niki/bin/homebrew/Cellar/sdl_image/1.2.12_7/include/SDL/ --extra-include-dirs=/Users/niki/bin/homebrew/Cellar/sdl_mixer/1.2.12_3/include/SDL/ --extra-include-dirs=/Users/niki/bin/homebrew/Cellar/sdl_ttf/2.0.11_1/include/ -f-kinect --extra-lib-dirs=/Users/niki/bin/homebrew/Cellar/sdl_image/1.2.12_7/lib/ --ghc-options=-optP-D_SDL_main_h SDL-image-0.6.1.2/

I get the following error:

Version.hsc:3:5: error: conflicting types for 'SDL_main'
int main (void)
    ^
/Users/niki/bin/homebrew/include/SDL/SDL_main.h:54:14: note: expanded from macro 'main'
#define main    SDL_main
                ^
/Users/niki/bin/homebrew/include/SDL/SDL_main.h:57:22: note: previous declaration is here
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
                     ^
1 error generated.

nikivazou avatar Jun 14 '18 15:06 nikivazou

@asandroq: You were able to set the game up on macOS. Did you experience any problems while installing and/or do you have an idea how to solve this one?

chriz-zeller avatar Jun 27 '18 06:06 chriz-zeller

Yes, I got the exact same error. I tried several things but in the end I worked around it by editing SDL_main.h and commenting out the line #define main SDL_main.

asandroq avatar Jun 27 '18 07:06 asandroq

Thank you @asandroq for the quick response.

@nikivazou: Can you please check the following:

  • Where is the version.hsc located, that provokes the error? Which library contains the version.hsc?

  • Does installing with the additional flag --ghc-options=-no-hs-main change anything?

  • Does @asandroq's solution work for you?

chriz-zeller avatar Jun 28 '18 13:06 chriz-zeller

@asandroq's solution worked, thanks!

nikivazou avatar Jul 13 '18 14:07 nikivazou

@nikivazou @asandroq Should anything be changed in any package? Either SDL-* or haskanoid?

ivanperez-keera avatar Jul 13 '18 15:07 ivanperez-keera

Also, could we turn this into a change to the README.md that includes the right installation instructions for Mac?

ivanperez-keera avatar Jul 13 '18 15:07 ivanperez-keera

@nikivazou What exactly did you do? Could you briefly write what worked so that we can, at least, add it as instructions? Were you able to install haskanoid and run it, or just run the command to install sdl?

ivanperez-keera avatar Aug 01 '18 10:08 ivanperez-keera

:bulb: My MacOS version is 10.14.6 (Mojave) and I was able to compile with the below instructions:

  • [x] I set the Haskel ghc version to 8.6.5 with ghcup but cabal version 3.x since I am currently using Euterpea
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
$ cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library 
  • [X] I proceed with installing SDL libraries with
$ brew install sdl sdl_image sdl_mixer sdl_ttf
  • [ ] As indicated above, I comment out the SDL Main Header /usr/local/Cellar/sdl/1.2.15_2/include/SDL/SDL_main.h on line 54
/** The application's main() function must be called with C linkage,
 *  and should be declared like this:
 *      @code
 *      #ifdef __cplusplus
 *      extern "C"
 *      #endif
 *      int main(int argc, char *argv[])
 *      {
 *      }
 *      @endcode
 */
// #define main SDL_main

:bookmark: Note: I also tried installing with the additional flag --ghc-options=-no-hs-mainbut there was a :x: linkage error

  • [x] I then installed the app by cloning the haskanoid repo and using the below flags
$ cabal install --flags="-kinect -wiimote"
  • [x] When running haskanoid it gives me a warning but it is working fine
$ haskanoid
Unable to obtain graphics context for NSWindow (Mojave behavior)
Could not load resource /Users/b300098957/.cabal/store/ghc-8.6.5/hsknd-0.1.5.4-8cb31c24/share/data/level0.mp3
libpng warning: iCCP: known incorrect sRGB profile
$ which haskanoid
/Users/setrar/.cabal/bin/haskanoid

Capture d’écran, le 2020-11-10 à 11 08 36

setrar avatar Nov 10 '20 16:11 setrar

:bulb: My MacOS version is 10.15.7 (Catalina) and I was able to compile with the below instructions:

  • [x] I set the Haskel ghc version to 8.8.4 with ghcup and cabal version 3.5
% ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.4
% cabal --version
cabal-install version 3.5.0.0
compiled using version 3.5.0.0 of the Cabal library 
  • [x] I proceed with installing SDL libraries using
$ brew install sdl sdl_image sdl_mixer sdl_ttf
  • [x] As indicated above, I comment out the SDL Main Header /usr/local/Cellar/sdl/1.2.15_2/include/SDL/SDL_main.h on line 54
/** The application's main() function must be called with C linkage,
 *  and should be declared like this:
 *      @code
 *      #ifdef __cplusplus
 *      extern "C"
 *      #endif
 *      int main(int argc, char *argv[])
 *      {
 *      }
 *      @endcode
 */
// #define main SDL_main
  • [x] I then installed the app by cloning the haskanoid repo and using the below flags
$ cabal install --flags="-kinect -wiimote"
Wrote tarball sdist to
/Users/setrar/Developer/haskanoid/dist-newstyle/sdist/haskanoid-0.1.5.4.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.8.4 -O1
...
...
Starting     haskanoid-0.1.5.4 (exe:haskanoid)
Building     haskanoid-0.1.5.4 (exe:haskanoid)
Installing   haskanoid-0.1.5.4 (exe:haskanoid)
Completed    haskanoid-0.1.5.4 (exe:haskanoid)
Symlinking 'haskanoid' to '/Users/setrar/.cabal/bin/haskanoid'
  • [x] When running haskanoid it still gives me NSWindow (Mojave behavior) warning and it is working oddly fine
$ haskanoid
Unable to obtain graphics context for NSWindow (Mojave behavior)
Could not load resource /Users/valiha/.cabal/store/ghc-8.6.5/hsknd-0.1.5.4-8cb31c24/share/data/level0.mp3
libpng warning: iCCP: known incorrect sRGB profile

:x: The app has a bug, the ball gets out of the game and doesn't come back.

haskanoid-bug-catalina

setrar avatar Nov 12 '20 14:11 setrar

Great news that you were able to install it!

Quick question: would you be able to send a PR updating the installation instructions for Mac, and we can open the issue about the ball separately? (seems unrelated to the fact that you are on mac).

ivanperez-keera avatar Nov 19 '20 04:11 ivanperez-keera