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

cannot compile under Ubuntu 14.04 #8

Closed
fossfreedom opened this issue Nov 28, 2015 · 7 comments
Closed

cannot compile under Ubuntu 14.04 #8

fossfreedom opened this issue Nov 28, 2015 · 7 comments

Comments

@fossfreedom
Copy link

I'm using ubuntu 14.04 which is Canonical's 5 year supports o/s

Unfortunately I cannot compile this under the o/s due to the older libraries available.

The projects CMake dependency is slated to be 3.0 or later :(

if I add this diff I can start compiling...

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bbdaf61..5a27b7c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 2.8)
 
 project(bliss C)
 
@@ -9,7 +9,7 @@ pkg_check_modules(MULTIMEDIA REQUIRED libavformat libavutil liba
 include_directories(${MULTIMEDIA_INCLUDE_DIRS} include/)
 link_directories(${MULTIMEDIA_LIBRARY_DIRS})
 add_definitions(${MULTIMEDIA_CFLAGS_OTHER})
-add_definitions(-Wall -Wno-long-long -pedantic)
+add_definitions(-Wall -Wno-long-long -std=c99)
 
 #####################################
 # Bliss target to build the library #

This then complains about the use of M_PI ... so I've applied this patch:

diff --git a/src/frequency_sort.c b/src/frequency_sort.c
index 2487375..a51b4be 100644
--- a/src/frequency_sort.c
+++ b/src/frequency_sort.c
@@ -2,6 +2,10 @@
 #include 
 #include "bliss.h"
 
+#ifndef M_PI
+#define M_PI           3.14159265358979323846
+#endif
+
 // Number of bits in the FFT, log2 of the length
 #define WIN_BITS 9
 // Length of the samples used in FFT

... this gets me down to these errors:

Linking C executable analyze
libbliss.so: undefined reference to `av_frame_unref'
libbliss.so: undefined reference to `av_frame_alloc'
libbliss.so: undefined reference to `av_frame_free'
collect2: error: ld returned 1 exit status
make[2]: *** [analyze] Error 1
make[1]: *** [CMakeFiles/analyze.dir/all] Error 2
make: *** [all] Error 2

I presume I'm missing linking against one of the libav libraries? - am I using too old a libav library or am I missing an explicit link in my library linking?

http://paste.ubuntu.com/13541453/

@Phyks
Copy link
Contributor

Phyks commented Nov 28, 2015

@Polochon-street this is the same issue as with Travis for the CMake version.

@fossfreedom You need the packages libbavcodec-dev, libavutil-dev and libavformat-dev afaik. And it should be ok then.

👍 for redefining M_PI. And as some c99 features are used, I think we should add the flag explicitly.

@fossfreedom
Copy link
Author

@Phyks - thanks for the quick reply.

I've got all three of those dev libraries installed :(

@Polochon-street
Copy link
Owner

I'm currently setting up an Ubuntu 14.04 VM to see what's going on - hang on!

@Phyks The C99 flag is in the CMakeLists.txt, isn't it?
I also changed the needed CMake version to 2.8.

@Polochon-street
Copy link
Owner

Okay @fossfreedom , I found out what the problem is here:

  • avcodec_alloc_frame had been deprecated in favour of av_frame_alloc.
  • avcodec_get_frame_defaults had been deprecated in favour of av_frame_unref.
  • avcodec_free_frame had been deprecated in favour of av_frame_free.

Since you seem to use an « old » version of libav, you need to change these functions in decode.c.
Here's a pastebin (github won't let me attach a .c file): http://pastebin.archlinux.fr/1746132

There must be a cleaner way to support both versions, maybe @Phyks has an idea?
Finally, I'm adding M_PI to bliss.h.

@Phyks
Copy link
Contributor

Phyks commented Nov 28, 2015

@Polochon-street I think the best way to handle it is to use an #ifdef structure. Maybe ffmpeg defines something to state which version it is? In this case, it is pretty straightforward. Else, you could rely on CMake to define it.

@fossfreedom
Copy link
Author

Latest commit seems to fix this.

Many thanks @Polochon-street & @Phyks for your help on this.

@Phyks
Copy link
Contributor

Phyks commented Nov 28, 2015

Cool! You're welcome!

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

3 participants