Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation error on mac #9

Open
nikivazou opened this issue Sep 24, 2017 · 11 comments
Open

Installation error on mac #9

nikivazou opened this issue Sep 24, 2017 · 11 comments

Comments

@nikivazou
Copy link

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
Copy link
Author

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.

@chriz-zeller
Copy link
Contributor

@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?

@asandroq
Copy link

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.

@chriz-zeller
Copy link
Contributor

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?

@nikivazou
Copy link
Author

@asandroq's solution worked, thanks!

@ivanperez-keera
Copy link
Owner

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

@ivanperez-keera
Copy link
Owner

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

@ivanperez-keera
Copy link
Owner

@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?

@setrar
Copy link

setrar commented Nov 10, 2020

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

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

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

  • I then installed the app by cloning the haskanoid repo and using the below flags
$ cabal install --flags="-kinect -wiimote"
  • 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
Copy link

setrar commented Nov 12, 2020

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

  • 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 
  • I proceed with installing SDL libraries using
$ 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
  • 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'
  • 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

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

haskanoid-bug-catalina

@ivanperez-keera
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants