2017-02-25 215 views
0

我剛將系統從Ubuntu 15.10升級到Ubuntu 16.04 LTS。現在,由於某種原因,我的C++項目不再編譯。克利翁口口聲聲說它缺少「libx264.so.146,你可以在編譯日誌中看到:在編譯C++代碼或x264本身時未找到libx264.so.146

/home/lorre851/CLion/bin/cmake/bin/cmake --build /home/lorre851/.CLion12/system/cmake/generated/ce7171e4/ce7171e4/Release --target main -- -j 8 
[ 20%] Linking CXX executable build/main 
/usr/bin/ld: warning: libx264.so.146, needed by /usr/local/lib/libavcodec.so.57, not found (try using -rpath or -rpath-link) 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_encoder_open_146' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_encoder_close' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_bit_depth' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_encoder_headers' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_encoder_encode' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_encoder_reconfig' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_param_parse' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_param_apply_profile' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_param_apply_fastfirstpass' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_levels' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_picture_init' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_param_default' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_param_default_preset' 
/usr/local/lib/libavcodec.so.57: undefined reference to `x264_encoder_delayed_frames' 
collect2: error: ld returned 1 exit status 
CMakeFiles/main.dir/build.make:172: recipe for target 'build/main' failed 
make[3]: *** [build/main] Error 1 
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/main.dir/all' failed 
make[2]: *** [CMakeFiles/main.dir/all] Error 2 
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/main.dir/rule' failed 
make[1]: *** [CMakeFiles/main.dir/rule] Error 2 
Makefile:118: recipe for target 'main' failed 
make: *** [main] Error 2 

大多數人似乎給了‘重裝X264’作爲解決方案。但是,使用以下命令重新安裝x264會在編譯x264時導致相同的錯誤。

git clone git://git.videolan.org/x264 
cd x264 
./configure --enable-static 
make 

/usr/bin/ld: warning: libx264.so.146, needed by /usr/local/lib/libavcodec.so, not found (try using -rpath or -rpath-link) 
/usr/local/lib/libavcodec.so: undefined reference to `x264_encoder_open_146' 
collect2: error: ld returned 1 exit status 
Makefile:202: recipe for target 'x264' failed 
make: *** [x264] Error 1 

有沒有人有一個想法,我可以解決這個問題?

+3

/usr/local/lib中的libav庫來自哪裏?這不是一個系統庫,但很可能是你已經安裝的。這個鏈接到一個較舊的x264 lib,它在16.04上不可用。您可能需要重新編譯這個libav庫或使用Ubuntu本身安裝的libav。 –

+0

弗洛裏安的評論應該是答案 – arved

回答

0

好吧,經過一天的嘗試刪除並重新編譯liavcodec-dev庫,沒有結果,我決定格式化驅動器並從頭重新安裝Ubuntu。

現在一切工作正常。