2011-06-27 106 views
4

我正在編譯源自Snow Leopard的ffmpeg。使用Macport不是一個選項,因爲我在ffmpeg中有一些自定義的修改。本作的命令是:對於架構x86_64,由於未定義符號_x264_encoder_open_112,Ffmpeg編譯失敗

$ ./configure --enable-gpl --enable-libmp3lame --enable-static \ 
      --disable-shared --enable-libx264 --enable-pthreads \ 
      --disable-doc --enable-avfilter 
$ make 

錯誤:

CC ffplay.o 
ffplay.c: In function ‘SDL_main’: 
ffplay.c:3157: warning: assignment discards qualifiers from pointer target type 
LD ffplay_g 
Undefined symbols for architecture x86_64: 
    "_x264_encoder_open_112", referenced from: 
     _X264_init in libavcodec.a(libx264.o) 
ld: symbol(s) not found for architecture x86_64 
collect2: ld returned 1 exit status 
make: *** [ffplay_g] Error 1 

我已經從源,其中又以精編libx264。

$ cd x264-snapshot-20101228-2245; ./configure && make && sudo make install 

...它包含符號 「_x264_encoder_open_112」

$ nm ./libx264.a | grep _x264_encoder_open_112 
0000000000003ef0 T _x264_encoder_open_112 
000000000000d7b0 S _x264_encoder_open_112.eh 

可能是什麼回事?

+0

你有沒有解決這個問題?我有完全相同的問題... – beardedd

+0

@beardedd我沒有一個確切的答案,但我必須重建庫。我想這是來自macport的衝突。所以,你可能需要暫時移除這些庫以強制gcc從'/ usr'中選擇x264.a,而不是'/ opt'。保持我們的發佈! –

回答

3

/opt/local/lib/usr/lib之間存在類似命名的庫之間的衝突。前者由Macport維護,後者是我自己的開發區。由於我想使用後者的位置,我不得不刪除/暫時重命名/opt/local/lib中的那些,以迫使gcc從/usr/lib中接收它們

就你而言,路徑可能會有所不同,但你明白了。

如果你有一個更清潔的方式來實現這一目標,我所有的耳朵

+2

我有同樣的問題,我只是從我的路徑中刪除/ opt/local/lib,而我做了./configure,解決了這個問題。建成後,我把它放回我的路上。 – dcoffey3296

+0

@ dcoffey3296這也行得通 –

0

嘗試使用--enable-static配置x264。

我有一個類似的問題,這對我來說是一個解決方案。

+0

嗨@weekens,恐怕這不起作用,因爲x264的配置不接受--enable-static。 '$ ./configure --enable-static 未知選項 - 啓用靜態,忽略# –

+0

@Saptarshi,這很奇怪,它在爲我工作之前。嘗試從Github上取下我的分支,只是爲了檢查它是否有效。 'git clone git://github.com/weekens/x264-devel。git' – weekens

+0

你是對的 - 來自'git:// git.videolan.org/x264.git'的最新來源確實支持--enable-static選項。我一直在使用舊的快照,這是造成混亂的根源。 但是,使用--enable-static不能解決我的問題。這是預料之中的,因爲我已經有了一個靜態的.a庫。 –

0

我要補充上有這個問題的Mac OSX家釀的用戶:

我不得不額外libx264庫中/usr/lib以及我不得不刪除。

這導致這個錯誤在建設的ffmpeg與brew install ffmpeg --use-clangbrew install ffmpeg --use-gcc

LD libavcodec/libavcodec.53.dylib 
AR libavcodec/libavcodec.a 
Undefined symbols for architecture x86_64: 
    "_x264_bit_depth", referenced from: 
     _X264_init_static in libx264.o 
     _X264_frame in libx264.o 
    "_x264_picture_init", referenced from: 
     _X264_frame in libx264.o 
    "_x264_param_default_preset", referenced from: 
     _X264_init in libx264.o 
    "_x264_param_apply_fastfirstpass", referenced from: 
     _X264_init in libx264.o 
    "_x264_param_apply_profile", referenced from: 
     _X264_init in libx264.o 
    "_x264_encoder_open_120", referenced from: 
     _X264_init in libx264.o 
ld: symbol(s) not found for architecture x86_64 
collect2: ld returned 1 exit status 
make: *** [libavcodec/libavcodec.53.dylib] Error 1 

多餘的文件是:

/usr/lib/libx264.79.dylib 
/usr/lib/libx264.a 
/usr/lib/libx264.dylib 

然而,這些版本可能會有所不同。刪除後,構建成功。

離開這個答案在這裏,因爲它是非常混亂試圖找到連接到libavcodec失敗。

相關問題