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

Ubuntu 14.04: compile error #594

Closed
legluondunet opened this issue Jan 2, 2015 · 49 comments
Closed

Ubuntu 14.04: compile error #594

legluondunet opened this issue Jan 2, 2015 · 49 comments
Assignees

Comments

@legluondunet
Copy link

Hello,

I tried to compile the last git code on Ubuntu 14.04 and I obtain this error:

$ cmake .
Note: Using SDL as renderer (default)
Note: SDL audio is enabled (default)
Note: FFMPEG video is enabled (default)
Note: FreeType2 is enabled (default)

Building CorsixTH
SDL found
-- Found LuaJIT library: /usr/lib/x86_64-linux-gnu/libluajit-5.1.so
LuaJIT found
SDL_mixer found
-- CMAKE_MODULE_PATH=/home/legluondunet/Applications_persos/Jeux/DOS/Theme_Hospital/Corsix-th/CorsixTH-master03012015/CMake
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find FFmpeg (missing: SWRESAMPLE_LIBRARIES
SWRESAMPLE_INCLUDE_DIRS)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
CMake/FindFFmpeg.cmake:145 (find_package_handle_standard_args)
CorsixTH/CMakeLists.txt:142 (FIND_PACKAGE)

-- Configuring incomplete, errors occurred!
See also "/home/legluondunet/Applications_persos/Jeux/DOS/Theme_Hospital/Corsix-th/CorsixTH-master03012015/CMakeFiles/CMakeOutput.log".
See also "/home/legluondunet/Applications_persos/Jeux/DOS/Theme_Hospital/Corsix-th/CorsixTH-master03012015/CMakeFiles/CMakeError.log".

Could you help me?

LGDN

@wolfy1339
Copy link
Contributor

Do you have the ffmpeg libraries installed? That's what that error points to; it can't find the FFMPEG development libraries.

@legluondunet
Copy link
Author

Ubuntu does not use FFMPEG but libav fork...FFMPEG is no more available in the Ubuntu official depot.
http://en.wikipedia.org/wiki/Libav

@Lego3
Copy link
Contributor

Lego3 commented Jan 3, 2015

Indeed. Therefore you need to add Severinsson's PPA if you want movie support. If you don't need it you can just do -D WITH_MOVIES=OFF in the cmake step. Otherwise the compile instructions link you to his site: https://launchpad.net/~jon-severinsson/+archive/ubuntu/ffmpeg
I will possibly create a pull request for a small script for ubuntu to do everything in one go.

@Lego3 Lego3 closed this as completed Jan 3, 2015
@Lego3
Copy link
Contributor

Lego3 commented Jan 3, 2015

Ok, so I went ahead a created that small script. It looks like this:
if ! grep -q "jon-severinsson/ffmpeg" /etc/apt/sources.list /etc/apt/sources.list.d/*; then
sudo add-apt-repository ppa:jon-severinsson/ffmpeg
else
echo "Jon Severinsson's PPA has already been added on this machine."
fi
sudo apt-get update
sudo apt-get install build-essential cmake libsdl1.2-dev libsdl-mixer1.2-dev timidity libfreetype6-dev libluajit-5.1-dev ffmpeg libavcodec-dev libavformat-dev libavresample libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libpostproc-dev libswresample-dev lua-socket

cmake .
cd CorsixTH
make

Try to fix bug in luasocket 3.0-rc1

sudo sed -i 's/ PROXY/ _M.PROXY/g' /usr/share/lua/5.1/socket/http.lua

I'll add that to the compile wiki page.

@Lego3
Copy link
Contributor

Lego3 commented Jan 3, 2015

Since I already had started on such a script I have now made a pull request about it here: #595

@legluondunet
Copy link
Author

Thank you Lego for your answer. But I don't think it's a good idea to install ffmpeg on a distribution that took the decision to use a fork of it: it could appear incompatibilities or others non yet unidentifed bugs...Another idea: use the libav fork. I don't know how adapt the corsix code to use the libav, but libav code's similare to ffmpeg code and has same librairies name.

Somewhere in the Corsix code:

If distribution=Ubuntu
use libavfork
then use ffmpeg
end;

@Lego3
Copy link
Contributor

Lego3 commented Jan 3, 2015

This has been discussed a few Times. However, using libav would require a lot of code changes, and according to some sources ffmpeg might be available in the next version of Ubuntu.

@legluondunet
Copy link
Author

You are right, ffmpeg will return in the 15.04. But to not interfer with libav librairies, ffmpeg files will be renamed.
For example:
dpkg -L libswresample-ffmpeg1
/.
/usr
/usr/share
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libswresample-ffmpeg1
/usr/share/doc
/usr/share/doc/libswresample-ffmpeg1
/usr/share/doc/libswresample-ffmpeg1/copyright
/usr/share/doc/libswresample-ffmpeg1/changelog.Debian.gz
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libswresample-ffmpeg.so.1.1.100
/usr/lib/x86_64-linux-gnu/libswresample-ffmpeg.so.1

Will Corsix-th find this renamed librairies?
And for the moment ffmpeg dev package are not planned...

@legluondunet
Copy link
Author

Another point, like said here http://www.webupd8.org/2014/11/ffmpeg-returns-to-official-ubuntu.html:

"Jon Severinsson's FFmpeg PPA was pretty popular but:

  • FFmpeg from this PPA uses the same library names as Libav so it might break stuff;"

Ubuntu softwares are compiled to use libav instead of ffmpeg, if you break Ubuntu libav, a lot of software could no more be runnable.

@TheCycoONE
Copy link
Member

When you run cmake you may need to point to the proper location. Incidentally for personal use you don't need that ppa, you can just copy ffmpeg libs to some local path and compile against that.

@legluondunet
Copy link
Author

I tried to compile it without video option, compilation finished ok.
Now since the game is more funny with video, I'm trying to find a workaround for Ubuntu.
Like TheCycoONE suggested me, I just downloaded ffmpeg from git, compiled it (OK) and launched cmake-gui to point ffmpeg include dirs option to my ffmpeg git folder root.
The compile failed just at the end...grrr
Please take a look here:

http://pastebin.com/N6Yaue0z

@TheCycoONE
Copy link
Member

Could you also paste your CMakeCache.txt

@legluondunet
Copy link
Author

this is my CMakeCache.txt
http://pastebin.com/xDmDcSUh

@TheCycoONE
Copy link
Member

Alright, you're getting linker errors with swresample.a. I'm not sure it's valid to be mixing libav and ffmpeg libraries like that, it seems likely that swresample.a would have unsatisfied dependencies so you might first try switching all your libav libraries to ffmpeg ones.

@legluondunet
Copy link
Author

This is my new CMakeCache.txt, now I think all FFMPEG dirs are right:
http://pastebin.com/AbH767et

Compile still failed at 100 % but the errors messages changed:
http://pastebin.com/Mt635DWb

@wolfy1339
Copy link
Contributor

Remove the versions numbers from your CMakeCache.txt, they are not needed.
Please try without the version numbers, and post the output.

@legluondunet
Copy link
Author

Done, but I obtained the same errors messagest:
http://pastebin.com/gwp4nC3V

My last CMakeCache.txt:
http://pastebin.com/KJmGshe5

Is Corsix-th compatible with last ffmpeg git?

@wolfy1339
Copy link
Contributor

I would try to use stable releases, instead of git revisions.
This PPA seems to work for Ubuntu Trusty when compiling.

@TheCycoONE
Copy link
Member

I believe if you can add -lz to your compile flags it should fix that error. Not entirely clear if that dependency only comes up because of the static linking or git ffmpeg, or some other reason.

@legluondunet
Copy link
Author

too difficult for me to link static FFMPEG librairies to Corsix-th. I think my FFMPEG compilation is not entirely static and ask for zlib librairies wich is external...and I don't know how to add zlib librairie in FFMPEG (and if it is possible...). But I don't have the level to go further...So I will install the Jefferson PPA when I would like to play Corsix-th and do a ppa-purge when I don't play...But it's a pity to penalize/annoying all Ubuntu/Debian users who want to use Corsix-th.

@TheCycoONE
Copy link
Member

The whole situation is extremely unfortunate, but we're not trying to penalize debian/ubuntu users. The ffmpeg/libav fork was extremely messy, with a lot of fud and misinformation being spread by both sides, and both sides claiming that they were the true ffmpeg so neither would change their library names to avoid collision. Further developers on the libav side held positions of authority at Debian/Ubuntu which lead to an overly hasty fragmentation of distros as well. The resampling libraries (libavresample from libav and libswresample from ffmpeg) were the worst affected because they were developed right at the beginning of the fork when the sides were most bitterly opposed. Anyway despite the information at the time it seems that ffmpeg is maintaining their libavresample library and switching to it would probably be a good choice - I may eventually do it my self as I'm no longer as fed up with it all as I was a year ago.

@legluondunet
Copy link
Author

Another good project like Performous, a Karaoke app for Linux, found a way to have compatibility for FFMPEG and LIBAV: performous/performous#115

Retroarch use FFMPEG and is Ubuntu compatible too.
Perrhaps you could contact to know if you could add libav compatibility without a big change in the code?

@TheCycoONE
Copy link
Member

Did you read that link you posted, they spent 3 months porting from libswresample to libavresample, which is exactly what I said was needed above.

@TobiX
Copy link

TobiX commented Jan 15, 2015

No, we spend 3 month porting from a state before there was any dedicated resample library (audio_resample in libavcodec) to libavresample. IIRC XBMC/Kodi has a shim that translates between avresample and swresample since they are very similar in interface. We just used libavresample since at that time both projects provided it and only ffmpeg has libswresample...

OTOH, both Debian and Ubuntu have ffmpeg back in their repository...

@TheCycoONE
Copy link
Member

Thanks for clearing that up @TobiX

@TheCycoONE
Copy link
Member

Sadly the zeranoe builds of ffmpeg for windows which we have been using do not contain libavresample. If I do decide to support libav it seems like I'd want to implement with both libraries and make cmake ask for one or the other.

@TheCycoONE TheCycoONE reopened this Jan 22, 2015
@TheCycoONE
Copy link
Member

And I am open to other people implementing this if anyone has any interest.

@TheCycoONE TheCycoONE self-assigned this Jan 22, 2015
@TheCycoONE
Copy link
Member

My pull request above solves this issue, pass -DWITH_LIBAV to cmake.

@legluondunet
Copy link
Author

Hello TheCycoOne,

happy to read you :)

I just tried:

configure OK
generate OK

but I have an compilation error:

http://pastebin.com/nPzhVPvU

@TheCycoONE
Copy link
Member

Interesting. I was writing this using libav-11.1 Which version are you using?

@TheCycoONE
Copy link
Member

Even in the oldest version of libav with documentation (0.5) av_recale_rnd is defined (https://libav.org/doxygen/release/0.5/mathematics_8h.html#ad686ab94939ed4c65218309e94bdca72) which should have been included by the #include<libavutil/avutil.h> line near the top of th_movies.cpp (https://libav.org/doxygen/release/0.5/avutil_8h.html)
Is it possible some of the remnants of your experiments with ffmpeg were left over? If you can't find anything, could you paste your CMakeCache.txt file contents.

@legluondunet
Copy link
Author

I tried to compile CorsixTH on another computer where I have never installed FFMPEG ppa (or other fmmpeg packages), same Ubuntu version (14.04 LTS), I obtain a similar error message:

http://pastebin.com/Ss4hMRJ0

@legluondunet
Copy link
Author

My CMakeCache.txt:
http://pastebin.com/mFDbSvNE

My libavutil package version:
libavutil51:am 6:0.8.7-1ubu amd64
libavutil52:am 6:9.16-0ubun amd64
libavutil-dev 6:9.16-0ubun amd64

@TheCycoONE
Copy link
Member

I looked at that version and it appears that mathematics.h is actually not being pulled in. Would you mind testing my theory?

In the extern "C" block at the top of CorsixTH\src\th_movie.cpp, just below #include<libavutil/avutil.h> could you add #include<libavutil/mathematics.h> and see if that fixes it?

@legluondunet
Copy link
Author

Just tested your theory:
....
[ 87%] Building CXX object CorsixTH/CMakeFiles/CorsixTH.dir/Src/th_sound.cpp.o
[ 90%] Building C object CorsixTH/CMakeFiles/CorsixTH.dir/Src/random.c.o
[ 93%] Building C object CorsixTH/CMakeFiles/CorsixTH.dir//LFS/lfs.c.o
[ 96%] Building C object CorsixTH/CMakeFiles/CorsixTH.dir/
/LFS/lfs_ext.c.o
[100%] Building C object CorsixTH/CMakeFiles/CorsixTH.dir/__/LPEG/lpeg.c.o
Linking CXX executable CorsixTH
make[2]: AVERTISSEMENT : décalage d'horloge détecté. La construction peut être incomplète.
[100%] Built target CorsixTH

This message means (google translation): WARNING: clock skew detected. The construction may be incomplete.

Anyway I obtained an executable and I can launch it.
I will tell you later if the video playing ok with this version, I don't have TH on the hard disk of my working office, it is better for my productivity ;).

@legluondunet
Copy link
Author

I just compiled CorsixTH-54e392b7b3a08b6c8169661972f1377c08fdae1c at home:
--> compilation ok with no error message
--> launch CorsixTH OK
--> first video: sound OK but no video, black window instead of video
--> aim screen with menu, choose new game OK
--> second video, only the first image, sound OK, then CorsixTH freeze, no active key, can not close it or interact anymore

Terminal log:

http://pastebin.com/KwG5TD14

@TheCycoONE
Copy link
Member

If you disable movies in your config.txt does the game work fine with that compile?

I think I'm going to have to install Ubuntu somewhere

@legluondunet
Copy link
Author

I changed the option in config.txt:
movies = false

and I can play the game.
I'm a little curious, what OS are you using? :)

@TheCycoONE
Copy link
Member

I have Arch Linux and Windows machines. For libav I've been using Windows because Arch uses ffmpeg.

@TheCycoONE
Copy link
Member

@legluondunet Just to eliminate certain possibilities;

Stephen@StephenG750 /cygdrive/e/Theme Hospital/HOSPITAL/ANIMS
$ md5sum *
4d0c496b10b1b451e91775b11d836f75 *320X2401.SMK
2482104ac9d185994dc31ac4eecb1fb1 *320X2402.SMK
241a38b84de945e52af66acfceeeb4ea *320X2403.SMK
cac991cb86962b70401a3c6722911c10 *320X2404.SMK
3abafe170e38df1328b46de6d8b5557a *320X2405.SMK
dc28d06cc94511eb60e2991dce8055c3 *320X2406.SMK
418c37b21abb838da7ed177dc58cfc45 *AREA01V.SMK
cd37e94f786a8e93c55be2f8ae0d7b0c *AREA02V.SMK
703f95bd357c7def52fd685248a1b1fb *AREA03V.SMK
369b93f872b7be880160fd5441580058 *AREA04V.SMK
1ef9f28b07a2f328aba7cee63b5e872d *AREA05V.SMK
234ea556ba5f3a683233dedaa3ef497b *AREA06V.SMK
dd0b8e9b3cfd545c9dade86973f7e232 *AREA07V.SMK
582ed9b17ddeea60e0f537f89a552185 *AREA08V.SMK
a7869a354753214290a0ac1d1b62f442 *AREA09V.SMK
2a5a9406a3594d3c30cb95a3be88e378 *AREA10V.SMK
b8e7d45a3b0173444d259177e10ec130 *AREA11V.SMK
ed46f581d2aca167dafe2caa114baae0 *AREA12V.SMK
fd49324840bcf4e0bb24bff094cee059 *AREA13V.SMK
625ade4e866efdaeb9d8a1e169fcc46c *AREA14V.SMK
f5012250aab9844ca41346a8651dcf94 *ATTRACT.SMK
48cb59596caed2e4a309686f6bc53394 *LOPAPER.SMK
844be5d66f842101d96726f1a69e10c3 *LOSE1.SMK
fe3010b2a74822d1fca46be00d4db307 *LOSE2.SMK
92dd1273563847e2d8345f406a1e0fd2 *LOSE3.SMK
35653bec56aac35006ea50ea7e143218 *LOSE4.SMK
8976d0f82938281498e9d1eab50a33d2 *LOSE5.SMK
b30fcad0a7ca654e74d5825bdd5d449a *LOSE6.SMK
e6923850b74703c48a056fbc9c52431f *MMENU1-0.SMK
7594c2c37bec795e4f89f19fb415fe98 *MMENU2-0.SMK
8fd881cf9f39cbf4923e4d331ef1b2ef *WINGAME.SMK
ad06e8010536d1776bf83e1b7d5a8a13 *WINLEVEL.SMK

and

Stephen@StephenG750 /cygdrive/e/Theme Hospital/HOSPITAL/INTRO
$ md5sum *
ad4bff04dfb64bc4216d821b4cf3d303 *ATTRACT.SMK
ad5a79ad8df98292220b16e6a29422c1 *INTRO.SM2
93eeb6c1bb704b976268e87d2a72067d *INTRO.SM4

@legluondunet
Copy link
Author

/Theme Hospital/HOSPITAL/ANIMS
$ md5sum *
4d0c496b10b1b451e91775b11d836f75 320X2401.SMK
2482104ac9d185994dc31ac4eecb1fb1 320X2402.SMK
241a38b84de945e52af66acfceeeb4ea 320X2403.SMK
cac991cb86962b70401a3c6722911c10 320X2404.SMK
3abafe170e38df1328b46de6d8b5557a 320X2405.SMK
dc28d06cc94511eb60e2991dce8055c3 320X2406.SMK
418c37b21abb838da7ed177dc58cfc45 AREA01V.SMK
cd37e94f786a8e93c55be2f8ae0d7b0c AREA02V.SMK
703f95bd357c7def52fd685248a1b1fb AREA03V.SMK
369b93f872b7be880160fd5441580058 AREA04V.SMK
1ef9f28b07a2f328aba7cee63b5e872d AREA05V.SMK
234ea556ba5f3a683233dedaa3ef497b AREA06V.SMK
dd0b8e9b3cfd545c9dade86973f7e232 AREA07V.SMK
582ed9b17ddeea60e0f537f89a552185 AREA08V.SMK
a7869a354753214290a0ac1d1b62f442 AREA09V.SMK
2a5a9406a3594d3c30cb95a3be88e378 AREA10V.SMK
b8e7d45a3b0173444d259177e10ec130 AREA11V.SMK
ed46f581d2aca167dafe2caa114baae0 AREA12V.SMK
fd49324840bcf4e0bb24bff094cee059 AREA13V.SMK
625ade4e866efdaeb9d8a1e169fcc46c AREA14V.SMK
f5012250aab9844ca41346a8651dcf94 ATTRACT.SMK
48cb59596caed2e4a309686f6bc53394 LOPAPER.SMK
844be5d66f842101d96726f1a69e10c3 LOSE1.SMK
fe3010b2a74822d1fca46be00d4db307 LOSE2.SMK
92dd1273563847e2d8345f406a1e0fd2 LOSE3.SMK
35653bec56aac35006ea50ea7e143218 LOSE4.SMK
8976d0f82938281498e9d1eab50a33d2 LOSE5.SMK
b30fcad0a7ca654e74d5825bdd5d449a LOSE6.SMK
e6923850b74703c48a056fbc9c52431f MMENU1-0.SMK
7594c2c37bec795e4f89f19fb415fe98 MMENU2-0.SMK
8fd881cf9f39cbf4923e4d331ef1b2ef WINGAME.SMK
ad06e8010536d1776bf83e1b7d5a8a13 WINLEVEL.SMK

/Theme Hospital/HOSPITAL/INTRO
$ md5sum *
ad4bff04dfb64bc4216d821b4cf3d303 attract.smk
ad5a79ad8df98292220b16e6a29422c1 intro.sm2
93eeb6c1bb704b976268e87d2a72067d intro.sm4

@TheCycoONE
Copy link
Member

Alright, so we've confirmed your movies are not corrupt. That's good. I'm working on getting an Ubuntu 14.04.1 LTS vm up and running, and maybe a 14.10 one while I'm at it. Will report back when I know more.

@TheCycoONE
Copy link
Member

I'm seeing the same behaviour as you in my Ubuntu 14.04.1 LTS VM. At least in my VM it appears that avplay (from libav-tools) can't play the intro properly either which doesn't inspire much confidence in that version. (I don't get a black screen, but I get the video with no sound, followed by the video being frozen with only the sound playing.)

Do you see the same thing? If so I think there's a bug with smacker playback that's only fixed in a later version.

@legluondunet
Copy link
Author

I just trying to play intro.sm4 with avplay:
video and sound play good untill the frog fully drawed, then video freeze.
I can hear the sound until the end of the video.

@TheCycoONE
Copy link
Member

Alright, that's the same as what I'm seeing with that libav version. So between that and the the "max analyze duration reached" error it looks like the smacker video codec in that version of libav is buggy.

When I next have time to sit with this there are a couple things I will check:
How Ubuntu 14.10 behaves (It uses the same version of libav that I've been targeting on Windows).
How libav 9.16 behaves on Windows
And finally whether I can workaround the issue by specifying the frame time stamps myself when an older version of libav is detected or whether it's deeper than that.

If we can't easily produce a workaround then we might just target Ubuntu 14.10 and higher for movies.

@TheCycoONE
Copy link
Member

I've confirmed that with my patch movies are working perfectly in Ubuntu 14.10.

@legluondunet
Copy link
Author

Good news, you done a very nice work! 👍 I will submit a bug to Ubuntu and ask them to update libav on last LTS.

@legluondunet
Copy link
Author

this is my bug report on launchpad:
https://bugs.launchpad.net/ubuntu/+source/libav/+bug/1415878
could you click on "this bug affect me too", thank you.

@Lego3
Copy link
Contributor

Lego3 commented Nov 28, 2015

Closing.

@Lego3 Lego3 closed this as completed Nov 28, 2015
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

5 participants