emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.84k stars 3.31k forks source link

ERROR: opus not found even though opus.pc exists in lib/pkgconfig folder #3280

Closed ajithreddy closed 5 years ago

ajithreddy commented 9 years ago

I keep getting this error always

./configure: 3762: ./configure: emnm: not found
ERROR: opus not found

opus.pc file exists in //lib/pkgconfig folder.

These are my configure options:

./configure --cross-prefix=em --cc=emcc --enable-cross-compile --target-os=none --arch=x86_32 \
 --prefix=$(pwd)/dist --extra-cflags=-I$(pwd)/dist/include\
 --extra-ldflags=-L$(pwd)/dist/lib\
 --pkg-config=$(pwd)/dist/lib/pkgconfig/\
 --cpu=generic --disable-hwaccels --disable-stripping --disable-pthreads --disable-doc --disable-debug --disable-asm \
 --disable-network --disable-everything --disable-ffplay --disable-ffprobe --disable-ffserver --disable-outdev=sdl \
 --enable-optimizations --enable-protocol=file  --enable-filter=aresample \
 --enable-demuxer=wav --enable-decoder=pcm_s16le --enable-decoder=pcm_u8 \
 --enable-libmp3lame --enable-demuxer=mp3 --enable-decoder=mp3 --enable-encoder=libmp3lame --enable-muxer=mp3 \
 --enable-gpl --enable-protocol=concat --enable-filter=concat --enable-libopus \
 --extra-libs="$(pwd)/dist/lib/libopus.a"

as you can see, I also specified the --pkg-config for it know the location of libraries. I am not sure why it is not able to locate the opus library.

kripken commented 9 years ago

What command does the configure script actually do, that fails to find opus?

ajithreddy commented 9 years ago

This is the command

./configure --cross-prefix=em --cc=emcc --enable-cross-compile --target-os=none --arch=x86_32 \
 --prefix=$(pwd)/dist --extra-cflags=-I$(pwd)/dist/include\
 --extra-ldflags=-L$(pwd)/dist/lib\
 --pkg-config=$(pwd)/dist/lib/pkgconfig/\
 --cpu=generic --disable-hwaccels --disable-stripping --disable-pthreads --disable-doc --disable-debug --disable-asm \
 --disable-network --disable-everything --disable-ffplay --disable-ffprobe --disable-ffserver --disable-outdev=sdl \
 --enable-optimizations --enable-protocol=file  --enable-filter=aresample \
 --enable-demuxer=wav --enable-decoder=pcm_s16le --enable-decoder=pcm_u8 \
 --enable-libmp3lame --enable-demuxer=mp3 --enable-decoder=mp3 --enable-encoder=libmp3lame --enable-muxer=mp3 \
 --enable-gpl --enable-protocol=concat --enable-filter=concat --enable-libopus \
 --extra-libs="$(pwd)/dist/lib/libopus.a"

This is the exact error I am getting

ERROR: opus not found using pkg-config
kripken commented 9 years ago

I mean, what command does configure issue? It does something concrete. Might need to look in config.log or something with a similar name.

ajithreddy commented 9 years ago

I am pasting the last 50 lines from the config.log

check_ld cc
check_cc
BEGIN /tmp/ffconf.F3ZMD1wZ.c
    1   #include <math.h>
    2   float foo(float f, float g) { return trunc(f); }
    3   int main(void){ return (int) foo; }
END /tmp/ffconf.F3ZMD1wZ.c
emcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/include -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.tlhd8vtV.o /tmp/ffconf.F3ZMD1wZ.c
WARNING  root: -I or -L of an absolute path "-I/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/include" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
emcc -L/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.LFPeeqN6 /tmp/ffconf.tlhd8vtV.o -lm /home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib/libopus.a
WARNING  root: -I or -L of an absolute path "-L/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
WARNING  root: emcc: cannot find library "m"
check_mathfunc truncf 1
check_ld cc
check_cc
BEGIN /tmp/ffconf.F3ZMD1wZ.c
    1   #include <math.h>
    2   float foo(float f, float g) { return truncf(f); }
    3   int main(void){ return (int) foo; }
END /tmp/ffconf.F3ZMD1wZ.c
emcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/include -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.tlhd8vtV.o /tmp/ffconf.F3ZMD1wZ.c
WARNING  root: -I or -L of an absolute path "-I/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/include" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
emcc -L/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.LFPeeqN6 /tmp/ffconf.tlhd8vtV.o -lm /home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib/libopus.a
WARNING  root: -I or -L of an absolute path "-L/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
WARNING  root: emcc: cannot find library "m"
check_lib lame/lame.h lame_set_VBR_quality -lmp3lame
check_header lame/lame.h
check_cpp
BEGIN /tmp/ffconf.F3ZMD1wZ.c
    1   #include <lame/lame.h>
    2   int x;
END /tmp/ffconf.F3ZMD1wZ.c
emcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/include -std=c99 -fomit-frame-pointer -E -o /tmp/ffconf.tlhd8vtV.o /tmp/ffconf.F3ZMD1wZ.c
check_func lame_set_VBR_quality -lmp3lame
check_ld cc -lmp3lame
check_cc
BEGIN /tmp/ffconf.F3ZMD1wZ.c
    1   extern int lame_set_VBR_quality();
    2   int main(void){ lame_set_VBR_quality(); }
END /tmp/ffconf.F3ZMD1wZ.c
emcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/include -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.tlhd8vtV.o /tmp/ffconf.F3ZMD1wZ.c
WARNING  root: -I or -L of an absolute path "-I/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/include" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
emcc -L/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.LFPeeqN6 /tmp/ffconf.tlhd8vtV.o -lmp3lame -lm /home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib/libopus.a
WARNING  root: -I or -L of an absolute path "-L/home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
WARNING  root: emcc: cannot find library "m"
check_pkg_config opus opus_multistream.h opus_multistream_decoder_create
false --exists --print-errors opus
ERROR: opus not found using pkg-config
kripken commented 9 years ago

Emscripten doesn't have pkg-config (it can't use the systemwide libraries), so you need to manually set it up.

ajithreddy commented 9 years ago

Thank you for the suggestion I think in my configure options I am specifying this:

--pkg-config=$(pwd)/dist/lib/pkgconfig/\

I am still getting this error. By manually setting do you mean, I need to go to 'configure' file and change something. Please guide me how to do this manually. Thanks

kripken commented 9 years ago

Reading the configure script should show how to do it manually. Alternatively you can create a makefile yourself without using configure perhaps.

ajithreddy commented 9 years ago

I tried adding manually, but no success. Meanwhile in config.log, I noticed this line at the starting:

xop_deps='avx'
xop_external_deps='avx_external'
xop_inline_deps='avx_inline'
xop_suggest='xop_external xop_inline'
xv_outdev_deps='X11_extensions_Xvlib_h XvGetPortAttribute'
xv_outdev_extralibs='-lXv -lX11 -lXext'
xvmc='yes'
xvmc_deps='X11_extensions_XvMClib_h'
xwma_demuxer_select='riffdec'
yasmexe_default='yasm'
zerocodec_decoder_select='zlib'
zlib_decoder_select='zlib'
zlib_encoder_select='zlib'
zmbv_decoder_select='zlib'
zmbv_encoder_select='zlib'
zmq_filter_deps='libzmq'
zoompan_filter_deps='swscale'
WARNING: /home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib/pkgconfig not found, library detection may fail.
mktemp -u XXXXXX
YnHcQD

The path ' /home/ajith/ffmpeg/audioconverter.js/ffmpeg-2.6.1/dist/lib/pkgconfig' which it says cannot be found actually exists and contains the *.pc files. This folder has all the read and write permissions. I am not sure why it is not able to find it.

bvibber commented 9 years ago

You have to set PKG_CONFIG_PATH or pkg-config won't find your .pc files. Try something like this:

emconfigure ./configure \ 
    --prefix="$dir/build/js/root" \ 
    PKG_CONFIG_PATH="$dir/build/js/root/lib/pkgconfig" 

emmake make 
emmake make install 
Kagami commented 9 years ago

You have to pass EM_PKG_CONFIG_PATH environment variable actually because ffmpeg's configure doesn't allow that type of option passing.

Look here for example: https://github.com/Kagami/ffmpeg.js/blob/master/Makefile#L157 (You could also use ffmpeg.js library from npm, it compiled with libopus encoder.)

jonmcnamaradale commented 8 years ago

A bit late, but I've been struggling with this for ages. I was getting the same error for all extra packages I was trying to compile FFMPEG with. I was following the guide at https://trac.ffmpeg.org/wiki/CompilationGuide/Centos which said to do PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" but pkg-config was ignoring packages in that directory.

Try this: Run pkg-config --list-all If you don't see any of the packages you expect, do PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH and then try again.

Hope this helps someone!

egywp commented 7 years ago

After a long struggle, I got around this by removing "--enable-libopus" from the .configure line at the guide https://trac.ffmpeg.org/wiki/CompilationGuide/Centos

PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -ldl" --bindir="$HOME/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265

So it becomes:

PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -ldl" --bindir="$HOME/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265

ibnux commented 7 years ago

i see that the first line must like this

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"

so it will be

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -ldl" --bindir="$HOME/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.