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

Can't compile on Linux Mint 19.1. #68

Closed
someone7070 opened this issue Jan 6, 2019 · 5 comments · May be fixed by #69
Closed

Can't compile on Linux Mint 19.1. #68

someone7070 opened this issue Jan 6, 2019 · 5 comments · May be fixed by #69

Comments

@someone7070
Copy link

someone7070 commented Jan 6, 2019

Hello. Sorry to bother you guys. I've done quite a bit of legwork trying to get this to work, installing all the dependencies I can think of, moving around header files and whatnot, but I am just completely unable to get this game to compile on Linux Mint 19.1 (the newest one). I got it to compile on another computer running Linux Mint 18.1 just fine though.

The error I am getting is this:

$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
checking GL/glew.h usability... no
checking GL/glew.h presence... no
checking for GL/glew.h... no
GLEW header was not found
checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking SDL/SDL.h usability... yes
checking SDL/SDL.h presence... yes
checking for SDL/SDL.h... yes
checking SDL/SDL_gfxPrimitives.h usability... yes
checking SDL/SDL_gfxPrimitives.h presence... yes
checking for SDL/SDL_gfxPrimitives.h... yes
checking SDL/SDL_mixer.h usability... no
checking SDL/SDL_mixer.h presence... no
checking for SDL/SDL_mixer.h... no
configure: error: SDL/SDL_mixer.h header was not found

I installed everything I could think of, including compiling the SDL_Mixer stuff from source, and nothing would work. I am guessing I need to include some directories or something, but nothing I used with ./configure --includedir would work.

On a related note, I also could not get the second compiling method to work. For that one, it was looking for various SDL header files in the /usr/local/include/SDL/ folder, which I eventually manually downloaded and moved to the folder. I got this error in the end:

$ make -f Makefile.simple
g++ -O2 -DLINUX -std=c++11 -march=native -W -Wall -Wextra -Werror -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -DCAP_GLEW=0 -DCAP_PNG=0 -c hyper.cpp -o hyper.o
In file included from compileunits.h:88:0,
from init.cpp:4,
from hyper.cpp:18:
sound.cpp: In function ‘void hr::handlemusic()’:
sound.cpp:102:7: error: ‘Mix_FadeInMusicPos’ was not declared in this scope
Mix_FadeInMusicPos(music[id], -1, musfadeval, musicpos[id] / 1000.0);
^~~~~~~~~~~~~~~~~~
sound.cpp:102:7: note: suggested alternative: ‘Mix_FadeInMusic’
Mix_FadeInMusicPos(music[id], -1, musfadeval, musicpos[id] / 1000.0);
^~~~~~~~~~~~~~~~~~
Mix_FadeInMusic
In file included from compileunits.h:40:0,
from init.cpp:4,
from hyper.cpp:18:
pattern2.cpp: In function ‘int hr::patterns::generateCanvas(hr::cell*)’:
pattern2.cpp:1327:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
if(archimedean) return colortables['A'][arcm::current.tilegroup[arcm::id_of(c->master)]];
^~
pattern2.cpp:1328:7: note: here
case 'B':
^~~~
In file included from compileunits.h:70:0,
from init.cpp:4,
from hyper.cpp:18:
screenshot.cpp: In function ‘void hr::anims::show()’:
screenshot.cpp:814:23: error: this statement may fall through [-Werror=implicit-fallthrough=]
dialog::addBreak(100);
~~~~~~~~~~~~~~~~^~~~~
screenshot.cpp:816:5: note: here
case maTranslation:
^~~~
cc1plus: all warnings being treated as errors
Makefile.simple:140: recipe for target 'hyper.o' failed
make: *** [hyper.o] Error 1

Dunno what that means. Any help appreciated!

@Quuxplusone
Copy link
Contributor

Thank you for providing the full text of the compiler errors! You guessed correctly that cc1plus: all warnings being treated as errors / recipe for target 'hyper.o' failed was not enough context to be helpful. :)

The error about Mix_FadeInMusicPos not being provided probably means that you're using an outdated version of the SDL_Mixer.h header file. I don't know any more specifics than that. Did you google the error message?

If you can't get your SDL_Mixer.h working, then you might try adding -DCAP_SDLAUDIO=0 to the compiler command line (in the obvious place(s) in Makefile.simple) and recompiling. Then it won't try to use SDL_Mixer.h at all.

The error about -Werror=implicit-fallthrough= is a real issue with the codebase. The easy workaround for you is to add -Wno-implicit-fallthrough to the compiler command line (in the obvious place(s) in Makefile.simple) and recompile.

Quuxplusone added a commit to Quuxplusone/hyperrogue that referenced this issue Jan 7, 2019
Clang doesn't enable this warning by default, so we pass it explicitly.
GCC pre-GCC 7 doesn't recognize the flag, so we can't pass it for GCC.
GCC 7 enables it by default as part of -Wextra.

Fixes zenorogue#68.
@someone7070
Copy link
Author

someone7070 commented Jan 8, 2019

Thank you for providing the full text of the compiler errors! You guessed correctly that cc1plus: all warnings being treated as errors / recipe for target 'hyper.o' failed was not enough context to be helpful. :)

Well, I assumed at first the output might look like garbage when copied and pasted over here, because it doesn't display in the terminal neatly.

The error about Mix_FadeInMusicPos not being provided probably means that you're using an outdated version of the SDL_Mixer.h header file. I don't know any more specifics than that. Did you google the error message?

I actually was trying to use the first method to compile the program, as this is what worked when I compiled it on my machine running Linux Mint 18.1. I only really tried the second method as an afterthought, and I had not actually searched for any information regarding the errors due to the second method. I generally don't use Google either.

If you can't get your SDL_Mixer.h working, then you might try adding -DCAP_SDLAUDIO=0 to the compiler command line (in the obvious place(s) in Makefile.simple) and recompiling. Then it won't try to use SDL_Mixer.h at all.

I'm not sure how I could be using an outdated version of SDL_Mixer.h. I have downloaded both SDL2_mixer 2.0 and 1.2 and compiled them from source and installed them. I even copied and pasted files from my Linux Mint 18.1 machine and put them in the exact same directories they were located in on that machine, and still the compiler doesn't seem to recognize their presence. Using the "--includedir" command doesn't solve anything either.

The error about -Werror=implicit-fallthrough= is a real issue with the codebase. The easy workaround for you is to add -Wno-implicit-fallthrough to the compiler command line (in the obvious place(s) in Makefile.simple) and recompile.

I might try that, but I still think I should be able to compile it with the other method.

@Quuxplusone
Copy link
Contributor

Looking through the issue history here will show you my opinion of the "other method." ;)

still the compiler doesn't seem to recognize their presence

Oh, it sees them, all right. If the compiler couldn't find "SDL_Mixer.h" in the filesystem, it would say

fatal error: SDL/SDL_Mixer.h: No such file or directory
    #include <SDL/SDL_Mixer.h>
             ^~~~~~~~~~~~~~~~~

So that's how I knew that you did have "SDL_Mixer.h" on your filesystem, but it contained C++ code that didn't mention Mix_FadeInMusicPos. We know your copy of "SDL_Mixer.h" does contain Mix_VolumeMusic, because that call (on the line right before the call to Mix_FadeInMusicPos) compiles cleanly.

I'll admit this is bizarre. The official distribution has had Mix_FadeInMusicPos since 2002, according to their git history.

Can you run the compiler command line with -H to see all included headers, and then upload a copy of your SDL_Mixer.h to pastebin for me to look at?

g++ -O2 -DLINUX -std=c++11 -march=native -W -Wall -Wextra -Werror \
    -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter \
    -DCAP_GLEW=0 -DCAP_PNG=0 -c hyper.cpp -o hyper.o -H | grep SDL_Mixer.h

@someone7070
Copy link
Author

someone7070 commented Jan 8, 2019

Looking through the issue history here will show you my opinion of the "other method." ;)

I'll have to check it out.

still the compiler doesn't seem to recognize their presence

Oh, it sees them, all right. If the compiler couldn't find "SDL_Mixer.h" in the filesystem, it would say

fatal error: SDL/SDL_Mixer.h: No such file or directory
    #include <SDL/SDL_Mixer.h>
             ^~~~~~~~~~~~~~~~~

So that's how I knew that you did have "SDL_Mixer.h" on your filesystem, but it contained C++ code that didn't mention Mix_FadeInMusicPos. We know your copy of "SDL_Mixer.h" does contain Mix_VolumeMusic, because that call (on the line right before the call to Mix_FadeInMusicPos) compiles cleanly.

Good to know it isn't an issue of the compiler not finding the file.

I'll admit this is bizarre. The official distribution has had Mix_FadeInMusicPos since 2002, according to their git history.

Can you run the compiler command line with -H to see all included headers, and then upload a copy of your SDL_Mixer.h to pastebin for me to look at?

I'm not sure what you're asking me to do. The ./configure script doesn't have an option for '-H'.

As for the contents of my SDL_mixer.h file (from the source /usr/include/SDL/SDL_mixer.h, as there are others), here it is:

https://pastebin.com/MxbvQgwj

g++ -O2 -DLINUX -std=c++11 -march=native -W -Wall -Wextra -Werror
-Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter
-DCAP_GLEW=0 -DCAP_PNG=0 -c hyper.cpp -o hyper.o -H | grep SDL_Mixer.h

I take it this is the command you want me to run in the terminal with the second method?

Output is here:

https://pastebin.com/un2rPvt1

@someone7070
Copy link
Author

someone7070 commented Jan 8, 2019

Okay, I think I got it fixed. It is compiling now. From the contents of the command you sent me, I noticed it was using the SDL_mixer.h file from the folder /usr/local/include/SDL and NOT from the folder /usr/include/SDL. So I copied the files over to /usr/local/include/SDL and the configure script was able to run successfully.

In the process of compiling now. Thanks for your help!

Edit: It compiled clean! Playing now.

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

Successfully merging a pull request may close this issue.

3 participants