GithubHelp home page GithubHelp logo

compile failed. about musly HOT 11 CLOSED

dominikschnitzer avatar dominikschnitzer commented on May 29, 2024
compile failed.

from musly.

Comments (11)

f0k avatar f0k commented on May 29, 2024

Hmm, this could be related to #26. On my machine it compiles fine both with an old and a new libav version, but maybe the #ifdef in libav.cpp is not entirely correct.
Can you try replacing #define AV_FRAME_FREE avcodec_free_frame with #define AV_FRAME_FREE av_frame_free? If this works, can you try to find out what LIBAVCODEC_VERSION_INT is in your version of libav?

from musly.

gary23chen avatar gary23chen commented on May 29, 2024

Thank you for you reply so quickly. I replaced #define AV_FRAME_FREE avcodec_free_frame with #define AV_FRAME_FREE av_frame_free, but it still reported the similar errors:
/root/musly/musly-master/libmusly/decoders/libav.cpp: In member function âvirtual std::vector<float, std::allocator > musly::decoders::libav::decodeto_22050hz_mono_float(const std::string&, float, float)â:
/root/musly/musly-master/libmusly/decoders/libav.cpp:370: error: av_frame_free was not declared in this scope
/root/musly/musly-master/libmusly/decoders/libav.cpp:404: error: av_frame_free was not declared in this scope
/root/musly/musly-master/libmusly/decoders/libav.cpp:484: error: av_frame_free was not declared in this scope

How can I find out what LIBAVCODEC_VERSION_INT is?

from musly.

gary23chen avatar gary23chen commented on May 29, 2024

I find the LIBAVCODEC_VERSION_INT in libav sourcecode:
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 35
#define LIBAVCODEC_VERSION_MICRO 0

#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR,
LIBAVCODEC_VERSION_MINOR,
LIBAVCODEC_VERSION_MICRO)

from musly.

gary23chen avatar gary23chen commented on May 29, 2024

I have tried to replace the version of libav from 0.8 to 11.7, the above problem of "av_frame_free not declared" is resolved. but I met a new problem while linking:
[root@dev02 build]# make
[ 12%] Built target musly_resample
Scanning dependencies of target libmusly
[ 16%] Building C object libmusly/CMakeFiles/libmusly.dir/kissfft/kiss_fft.c.o
[ 20%] Building C object libmusly/CMakeFiles/libmusly.dir/kissfft/kiss_fftr.c.o
[ 24%] Building CXX object libmusly/CMakeFiles/libmusly.dir/methods/mandelellis.cpp.o
[ 28%] Building CXX object libmusly/CMakeFiles/libmusly.dir/methods/timbre.cpp.o
[ 32%] Building CXX object libmusly/CMakeFiles/libmusly.dir/decoders/libav.cpp.o
[ 36%] Building CXX object libmusly/CMakeFiles/libmusly.dir/resampler.cpp.o
[ 40%] Building CXX object libmusly/CMakeFiles/libmusly.dir/plugins.cpp.o
[ 44%] Building CXX object libmusly/CMakeFiles/libmusly.dir/method.cpp.o
[ 48%] Building CXX object libmusly/CMakeFiles/libmusly.dir/decoder.cpp.o
[ 52%] Building CXX object libmusly/CMakeFiles/libmusly.dir/windowfunction.cpp.o
[ 56%] Building CXX object libmusly/CMakeFiles/libmusly.dir/powerspectrum.cpp.o
[ 60%] Building CXX object libmusly/CMakeFiles/libmusly.dir/melspectrum.cpp.o
[ 64%] Building CXX object libmusly/CMakeFiles/libmusly.dir/discretecosinetransform.cpp.o
[ 68%] Building CXX object libmusly/CMakeFiles/libmusly.dir/mfcc.cpp.o
[ 72%] Building CXX object libmusly/CMakeFiles/libmusly.dir/gaussianstatistics.cpp.o
[ 76%] Building CXX object libmusly/CMakeFiles/libmusly.dir/mutualproximity.cpp.o
[ 80%] Building CXX object libmusly/CMakeFiles/libmusly.dir/lib.cpp.o
Linking CXX shared library libmusly.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(allcodecs.o): relocation R_X86_64_32 against `ff_a64multi_encoder' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libmusly/libmusly.so] Error 1
make[1]: *** [libmusly/CMakeFiles/libmusly.dir/all] Error 2
make: *** [all] Error 2

from musly.

f0k avatar f0k commented on May 29, 2024

I find the LIBAVCODEC_VERSION_INT in libav sourcecode:
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 35
#define LIBAVCODEC_VERSION_MICRO 0

This is libav 0.8.1. Checking my version (the one of Ubuntu 14.04 LTS), I see that I actually have libav 9, and libavcodec_free_frame was only introduced in that version (http://upstream.rosalinux.ru/compat_reports/libav/0.8.17_to_9/abi_compat_report.html). So the current code is incompatible with libav 0.8, sorry! I'll see if this is the only incompatibility and fix it, but probably only by next week.

Anyway, we've discovered several bugs in libav in the last years, so I'd recommend using the latest version if you can.

Linking CXX shared library libmusly.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(allcodecs.o): relocation R_X86_64_32 against `ff_a64multi_encoder' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value

It's easier if you build shared libraries for libav. When compiling libav for CentOS, run:

git clone git://git.libav.org/libav.git libav
cd libav
mkdir build && cd build
../configure --enable-shared --disable-symver
make && make install

Otherwise, you may try to recompile with -fPIC as indicated; to do so you will need to change the CXXFLAGS when configuring musly. Let me know if it works!

from musly.

gary23chen avatar gary23chen commented on May 29, 2024

I have tried to build libav as shared libraries, but it didn't work. Then I try to recompile the musly with -fPIC. As I have no experience on cpp compiling, I find that there is CXX_FLAGS in CMakeCache.txt, so I try to modify the CMakeCache.txt as:
//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++

//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=-fPIC

But the issue still bothered me after recompile. Could you give me some more information about how to change the CXXFLAGS? Thank you!

from musly.

f0k avatar f0k commented on May 29, 2024

I have tried to build libav as shared libraries, but it didn't work.

What exactly happened when you tried? I've successfully built it on centOS before.

Could you give me some more information about how to change the CXXFLAGS?

If you configure with ccmake .., you can toggle to advanced mode (with t) and enter it in the GUI. If you configure with cmake .., just append cmake .. -DCXXFLAGS=-fPIC. Not sure if this will really work, I haven't tried compiling against a static libav.

from musly.

gary23chen avatar gary23chen commented on May 29, 2024

Great! I reconfigured the musly by appending "cmake .. -DCMAKE_CXX_FLAGS:STRING=-fPIC" and recompiled it successfully. Now it works on my centOS! Thank you very much!

BTW, I build libav as shared libraries successfully yesterday, but it didn't work for resolving the linking problem in musly compiling. It looks like musly must be built with -fPIC as what I did just now.

from musly.

f0k avatar f0k commented on May 29, 2024

Good to know you've got it working! I've been able to build musly on centOS without changing the CMAKE_CXX_FLAGS, though. Anyway, I will try to fix the libav 0.8 incompatibility next week. Thanks for reporting it!

from musly.

f0k avatar f0k commented on May 29, 2024

I've updated libav.cpp so it works with libav 0.8 again. Thanks for your report! (I still recommend using a later version of libav, or ffmpeg.)

from musly.

gary23chen avatar gary23chen commented on May 29, 2024

Thank you for informing me this.

from musly.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.