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

SDL under ghc 7.8.2 #2

Closed
tbelaire opened this issue Sep 24, 2014 · 19 comments
Closed

SDL under ghc 7.8.2 #2

tbelaire opened this issue Sep 24, 2014 · 19 comments

Comments

@tbelaire
Copy link

It requires a slight fix, if anyone else encounters a problem installing with a recent ghc, here's how I fixed that problem.

File structure is something like

haskanoid-root/
|-> cabal.sandbox.config
\-> haskanoid/
      |->haskanoid.cabal
          .....

From haskanoid-root, (where you ran cabal sandbox init, also do cabal sdl unpack, to get something like:

haskanoid-root/
|-> cabal.sandbox.config
|-> SDL-0.6.5
\-> haskanoid/
      |->haskanoid.cabal
          .....

And edit Graphics/UI/SDL/Events.hsc line 56 to just be import Data.Typeable instead of being very selective in it's imports. Now you can cabal install from the SDL directory to get that dependency fixed.
You'll also need to bump up the base==4.6.* requirement in haskanoid.cabal`.

@tbelaire tbelaire changed the title SDL undeo ghc 7.8.2 SDL under ghc 7.8.2 Sep 24, 2014
@ivanperez-keera
Copy link
Owner

Thanks!

It might be a good thing to open a ticket on SDL itself, since the typeable thing is their responsibility.

There's two pending tasks here: modify the readme to reflect these instructions, and change the cabal file.

ivanperez-keera added a commit that referenced this issue Sep 24, 2014
Both issues #1 and #2 contain important remarks that may be helpful. Until they make it into the code itself, I'm at least mentioning them here.
@tbelaire
Copy link
Author

I've fired the maintainer of SDL an email, since that's all I saw on Hackage.

Once a new SDL version is out, it'll be easy enough to bump version bounds to get haskanoid to compile, without needing any fancy instructions.

@listx
Copy link

listx commented Sep 27, 2014

I just followed @tbelaire's instructions and doing cabal install from where SDL is located resulted in installing to my system's cabal folder ~/.cabal. I fixed this by doing cabal sandbox add-source SDL-0.6.5 from haskanoid-root, which is actually just the git clone directory of haskanoid (this is because trying it from the hackage version resulted in the game not starting due to missing data files, giving the error message Some resources could not be loaded).

@Jks15063
Copy link

The instructions don't mention downloading SDL but the project doesn't seem to include it. Should I just download the latest version of sdl and copy it into the project directory?

@tbelaire
Copy link
Author

cabal sdl unpack downloads the source code.

@Jks15063
Copy link

When I run cabal sdl unpack it replies: cabal: unrecognised command: sdl (try --help)

@tbelaire
Copy link
Author

Err, I think I mean cabal unpack sdl, sorry.
On Oct 16, 2014, at 12:50 PM, Jake Sellers notifications@github.com wrote:

When I run cabal sdl unpack it replies: cabal: unrecognised command: sdl (try --help)


Reply to this email directly or view it on GitHub.

@Jks15063
Copy link

OK, cabal unpack sdl works and I now see a SDL dir. However, after editing the Graphics file per your instructions and running cabal install in the root SDL dir, I see this error:

Resolving dependencies...
Configuring SDL-0.6.5...
Failed to install SDL-0.6.5
Build log ( /home/jake/.cabal/logs/SDL-0.6.5.log ):
Configuring SDL-0.6.5...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
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: Error: some packages failed to install:
SDL-0.6.5 failed during the configure step. The exception was:
ExitFailure 1

I looked in the README in the SDL dir and tried running runhaskell Setup.lhs configure and received an almost identical error message.

Am I way off?

@tbelaire
Copy link
Author

the Haskell sdl bindings require SDL to have been installed, as they are just translations to the C calls to the library.
On Oct 16, 2014, at 1:04 PM, Jake Sellers notifications@github.com wrote:

OK, cabal unpack sdl works and I now see a SDL dir. However, after editing the Graphics file per your instructions and running cabal install in the root SDL dir, I see this error:

Resolving dependencies...
Configuring SDL-0.6.5...
Failed to install SDL-0.6.5
Build log ( /home/jake/.cabal/logs/SDL-0.6.5.log ):
Configuring SDL-0.6.5...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
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: Error: some packages failed to install:
SDL-0.6.5 failed during the configure step. The exception was:
ExitFailure 1

I looked in the README in the SDL dir and tried running runhaskell Setup.lhs configure and received an almost identical error message.

Am I way off?


Reply to this email directly or view it on GitHub.

@Jks15063
Copy link

ok, getting real close. Got sdl installed and then ran into a bunch of missing dev libs so worked my way down the list installing them like this: sudo apt-get install libghc-foo-dev which worked for every except the wii lib. I ran sudo apt-get install libghc-hcwiid-dev which executed succesfully, but I still get this error:

setup-Simple-Cabal-1.21.1.0-x86_64-linux-ghc-7.8.3: Missing dependencies on
foreign libraries:
* Missing (or bad) header file: cwiid.h
* Missing C libraries: bluetooth, cwiid
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
cabal: Error: some packages failed to install:
hcwiid-0.0.5 failed during the configure step. The exception was:
ExitFailure 1

Is there a lib I'm still missing or a way to ignore the wii libs, I'm not trying to use a wii-mote anyway.
Sorry for all the questions and thanks for all the help already.

@codygman
Copy link

You don't want to mix installing Haskell packages and cabal packages I
don't think (someone correct me if I'm wrong).

I typically use apt-get build-dep on Haskell packages that require external
dependencies such as SDL.

When I get to a computer I'll post a command line log of installing
haskanoid on vanilla Ubuntu.
On Oct 16, 2014 2:44 PM, "Jake Sellers" notifications@github.com wrote:

ok, getting real close. Got sdl installed and then ran into a bunch of
missing dev libs so worked my way down the list installing them like this: sudo
apt-get install libghc-foo-dev which worked for every except the wii lib.
I ran sudo apt-get install libghc-hcwiid-dev which executed succesfully,
but I still get this error:

setup-Simple-Cabal-1.21.1.0-x86_64-linux-ghc-7.8.3: Missing dependencies on
foreign libraries:

  • Missing (or bad) header file: cwiid.h
  • Missing C libraries: bluetooth, cwiid
    This problem can usually be solved by installing the system packages that
    provide these libraries (you may need the "-dev" versions). If the libraries
    are already installed but in a non-standard location then you can use the
    flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
    If the header file does exist, it may contain errors that are caught by the C
    compiler at the preprocessing stage. In this case you can re-run configure
    with the verbosity flag -v3 to see the error messages.
    cabal: Error: some packages failed to install:
    hcwiid-0.0.5 failed during the configure step. The exception was:
    ExitFailure 1

Is there a lib I'm still missing or a way to ignore the wii libs, I'm
trying to use a wii-mote anyway.
Sorry for all the questions and thanks for all the help already.


Reply to this email directly or view it on GitHub
#2 (comment)
.

@Jks15063
Copy link

That sounds great, thanks. Should I remove all of the libghc-... packages I installed?

@codygman
Copy link

That's what I would do, then again I don't know if any of your other
software packages/projects/workflows would be broken by that.

I think I only have that separation because I'm paranoid about cabal being
able to find apt installed ghc libraries.
On Oct 16, 2014 3:00 PM, "Jake Sellers" notifications@github.com wrote:

That sounds great, thanks. Should I remove all of the libghc-... packages
I installed?


Reply to this email directly or view it on GitHub
#2 (comment)
.

@sphvn
Copy link

sphvn commented Jan 7, 2015

I'm getting the same issue as @Jks15063

* Missing (or bad) header file: cwiid.h
* Missing C libraries: bluetooth, cwiid

Did anyone come up with a workaround for this? Running on ubuntu-14.04.1-desktop-amd64.

@ivanperez-keera
Copy link
Owner

I suspect the problem is that this game uses a new version of hcwiid that was released with accelerometer support, specifically for this game. That version is the lastest one available on hackage. It may already be available in some debian-like distributions like ubuntu, but I don't know if 14.04 has the latest version. If not, then installing haskanoid will try to fetch the latest from hackage, and will need the bluetooth and cwiid development libraries, which are not pulled by libghc-hcwiid-dev (only the binaries are installed, not the headers).

If the above is correct, you need to install libcwiid-dev with apt-get/aptitude, and then hcwiid directly from hackage. The latter should happen automatically when you run "cabal install haskanoid".

Does that work?

@sphvn
Copy link

sphvn commented Jan 8, 2015

Cheers. Up and running, without having to unpack and modify SDL also.

@sunwukonga
Copy link

On my system (archlinux), in addition to unpacking and fixing the Data.Typeable import in Event.hsc, I had missing libraries for both the SDL_ttf and SDL_mixer dependencies.

The readme's of both packages mentioned the required library dependency and I installed with pacman.

pacman -S sdl_ttf sdl_mixer

Haskanoid compiled and ran fine after that.

@ivanperez-keera
Copy link
Owner

So, I just ran cabal install --only-dependencies with ghc 7.8.4 and ghc 7.10.3 and SDL compiled just fine. Is the installation of SDL still problematic on your machines?

What else do you think should be modified in the README.md file to make the installation instructions clear? Do we need to link to some manual that explains how to install the SDL bindings, SDL libraries or wiimote/kinect libraries?

@ivanperez-keera
Copy link
Owner

This issue has been frozen for some time. I'm going to close it, since it compiles fine on travis. If you think the instructions are insufficient, then please re-open or, better, send a pull request for a modified README.md!

I'd love to get contributions :)

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

No branches or pull requests

7 participants