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

Compilation issue #12

Open
chaozhou5 opened this issue Feb 8, 2017 · 10 comments
Open

Compilation issue #12

chaozhou5 opened this issue Feb 8, 2017 · 10 comments

Comments

@chaozhou5
Copy link

Hi,

Thanks a lot for your work. I am trying to compile the code and test some videos. However, I end up with the error shows below. After spend hours on this error, I still cannot pass it. Could you please help me and take a look at this error?

I working at ubuntu 14.04 with gcc 5.4.1, opencv 3.1.0, boost 1.54.0.1, cmake 3.2.2

[ 6%] Building CXX object LibAvWrapper/CMakeFiles/LibAvWrapper.dir/src/VideoWriter.cpp.o In file included from /home/chao/VR/360Transformations/transformation/LibAvWrapper/src/VideoWriter.cpp:1:0: /home/chao/VR/360Transformations/transformation/LibAvWrapper/inc/VideoWriter.hpp: In member function ‘void IMT::LibAv::VideoWriter::Init(std::string, std::array<unsigned int, nbStreams>, std::array<unsigned int, nbStreams>, unsigned int, unsigned int, std::array<unsigned int, nbStreams>)’: /home/chao/VR/360Transformations/transformation/LibAvWrapper/inc/VideoWriter.hpp:59:96: error: there are no arguments to ‘avformat_alloc_output_context2’ that depend on a template parameter, so a declaration of ‘avformat_alloc_output_context2’ must be available [-fpermissive] avformat_alloc_output_context2(&m_fmt_ctx, NULL, NULL, m_outputFileName.c_str()); ^ /home/chao/VR/360Transformations/transformation/LibAvWrapper/inc/VideoWriter.hpp:59:96: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /home/chao/VR/360Transformations/transformation/LibAvWrapper/src/VideoWriter.cpp: In member function ‘void IMT::LibAv::VideoWriter::PrivateWrite(std::shared_ptr<IMT::LibAv::Packet>, int)’: /home/chao/VR/360Transformations/transformation/LibAvWrapper/src/VideoWriter.cpp:77:105: error: ‘av_rescale_q’ was not declared in this scope pkt.pts = av_rescale_q(pkt.pts, m_codec_ctx[streamId]->time_base, m_vstream[streamId]->time_base); ^ /home/chao/VR/360Transformations/transformation/LibAvWrapper/src/VideoWriter.cpp:81:105: error: ‘av_rescale_q’ was not declared in this scope pkt.dts = av_rescale_q(pkt.dts, m_codec_ctx[streamId]->time_base, m_vstream[streamId]->time_base); ^ make[2]: *** [LibAvWrapper/CMakeFiles/LibAvWrapper.dir/src/VideoWriter.cpp.o] Error 1 make[1]: *** [LibAvWrapper/CMakeFiles/LibAvWrapper.dir/all] Error 2 make: *** [all] Error 2

Chao

@JesseYang-CQ
Copy link

Hi, CHAO. same problem with me, do you solve it yet?

@JesseYang-CQ
Copy link

root@ubun:/usr/local/transformation/build# make
[ 6%] Building CXX object LibAvWrapper/CMakeFiles/LibAvWrapper.dir/src/VideoWriter.cpp.o
In file included from /usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:1:0:
/usr/local/transformation/LibAvWrapper/inc/VideoWriter.hpp: In member function ‘void IMT::LibAv::VideoWriter::Init(std::string, std::array<unsigned int, nbStreams>, std::array<unsigned int, nbStreams>, unsigned int, unsigned int, std::array<unsigned int, nbStreams>)’:
/usr/local/transformation/LibAvWrapper/inc/VideoWriter.hpp:58:96: error: there are no arguments to ‘avformat_alloc_output_context2’ that depend on a template parameter, so a declaration of ‘avformat_alloc_output_context2’ must be available [-fpermissive] avformat_alloc_output_context2(&m_fmt_ctx, NULL, NULL, m_outputFileName.c_str());
/usr/local/transformation/LibAvWrapper/inc/VideoWriter.hpp:58:96: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/local/transformation/LibAvWrapper/inc/VideoWriter.hpp:105:38: error: ‘struct AVCodecContext’ has no member named ‘refcounted_frames’m_codec_ctx[id]->refcounted_frames = 1;
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp: In member function ‘void IMT::LibAv::VideoWriter::EncodeAndWrite(const cv::Mat&, int)’:
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:113:37: error: ‘av_frame_alloc’ was not declared in this scope
AVFrame* frame = av_frame_alloc();
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp: In member function ‘void IMT::LibAv::VideoWriter::EncodeAndWrite(AVFrame*, int)’:
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:148:62: error: ‘avcodec_send_frame’ was not declared in this scope
int ret = avcodec_send_frame(m_codec_ctx[streamId], frame);
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:165:67: error: ‘avcodec_receive_packet’ was not declared in this scope
ret = avcodec_receive_packet(m_codec_ctx[streamId], &pkt);
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:171:115: error: ‘av_rescale_q’ was not declared in this scope
pkt.pts = av_rescale_q(pkt.pts, m_codec_ctx[streamId]->time_base, m_vstream[streamId]->time_base);
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:175:115: error: ‘av_rescale_q’ was not declared in this scope
pkt.dts = av_rescale_q(pkt.dts, m_codec_ctx[streamId]->time_base, m_vstream[streamId]->time_base);
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:185:35: error: ‘av_packet_unref’ was not declared in this scope
av_packet_unref(&pkt); //The pkt is not usefull anymore
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:190:33: error: ‘av_packet_unref’ was not declared in this scope
av_packet_unref(&pkt);
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:198:27: error: ‘av_frame_unref’ was not declared in this scope
av_frame_unref(frame);
/usr/local/transformation/LibAvWrapper/src/VideoWriter.cpp:200:27: error: ‘av_frame_free’ was not declared in this scope
av_frame_free(&frame);
make[2]: *** [LibAvWrapper/CMakeFiles/LibAvWrapper.dir/src/VideoWriter.cpp.o] Error 1
make[1]: *** [LibAvWrapper/CMakeFiles/LibAvWrapper.dir/all] Error 2

@chaozhou5
Copy link
Author

chaozhou5 commented Feb 9, 2017 via email

@JesseYang-CQ
Copy link

Hi Chao,
Thanks, So you think the problem is the version of gcc, I use the same version as you, maybe i think, let's figure it out.
Jesse

@JesseYang-CQ
Copy link

JesseYang-CQ commented Feb 11, 2017 via email

@chaozhou5
Copy link
Author

Hi Jesse,

No, it still doesn't work. I have no clue what's going on with this issue :(

@JesseYang-CQ
Copy link

Hi Chao
i reinstall my Gcc and FFmpeg, seams like works, But, anther prolem is coming, like this:
ideoWriter::EncodeAndWrite(cv::Mat const&, int)':
VideoWriter.cpp:(.text+0x2b9): undefined reference to av_frame_alloc' ../LibAvWrapper/libLibAvWrapper.a(VideoReader.cpp.o): In function ToMat(AVCodecContext*, AVFrame*)':
VideoReader.cpp:(.text+0x8de): undefined reference to av_frame_alloc' VideoReader.cpp:(.text+0xc8d): undefined reference to av_frame_unref'
VideoReader.cpp:(.text+0xc97): undefined reference to av_frame_free' ../LibAvWrapper/libLibAvWrapper.a(VideoReader.cpp.o): In function IMT::LibAv::VideoReader::DecodeNextStep()':
VideoReader.cpp:(.text+0x109b): undefined reference to av_frame_alloc' VideoReader.cpp:(.text+0x10c4): undefined reference to avcodec_send_packet'
VideoReader.cpp:(.text+0x10e1): undefined reference to avcodec_receive_frame' VideoReader.cpp:(.text+0x126d): undefined reference to av_frame_unref'
VideoReader.cpp:(.text+0x12d9): undefined reference to av_frame_free' VideoReader.cpp:(.text+0x12e3): undefined reference to av_packet_unref'
VideoReader.cpp:(.text+0x133f): undefined reference to avcodec_send_packet' VideoReader.cpp:(.text+0x135c): undefined reference to av_frame_alloc'
VideoReader.cpp:(.text+0x1418): undefined reference to avcodec_receive_frame' VideoReader.cpp:(.text+0x1479): undefined reference to av_frame_free'
VideoReader.cpp:(.text+0x153d): undefined reference to `av_frame_unref'
collect2: error: ld returned 1 exit status
make[2]: *** [MainProject/trans] Error 1
make[1]: *** [MainProject/CMakeFiles/trans.dir/all] Error 2
make: *** [all] Error 2

@chaozhou5
Copy link
Author

chaozhou5 commented Feb 14, 2017 via email

@JesseYang-CQ
Copy link

Hi chao,
on my side, i update the Gcc version to 5.2.0, Then remove the old ffmpeg, reinstall a new version,maybe you could fellow the reference, http://blog.csdn.net/wstzone/article/details/40823499

Jesse

@nidhimundra
Copy link

Hi @JesseYang-CQ, we are facing the same issue. How did you finally fix this?

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