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

Openssl not found while compiling ffmpeg on linux x64 #32

Closed
beligum opened this issue Jan 11, 2015 · 9 comments
Closed

Openssl not found while compiling ffmpeg on linux x64 #32

beligum opened this issue Jan 11, 2015 · 9 comments
Labels

Comments

@beligum
Copy link
Contributor

beligum commented Jan 11, 2015

Using version 0.10 on Ubuntu Trusty. Everything works fine until ffmpeg/cppbuild.sh tries to compile ffmpeg, quitting with "ERROR: openssl not found". Any thoughts?

@saudet
Copy link
Member

saudet commented Jan 12, 2015

Does it look like the OpenSSL libraries and header files get properly installed? What are the last few lines of the config.log that FFmpeg generates?

@beligum
Copy link
Contributor Author

beligum commented Jan 18, 2015

Yes, everything seems to be installed fine.

Here's the relevant part of config.log

check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto
check_header openssl/ssl.h
check_cpp
BEGIN /tmp/ffconf.i4FhSrZW.c
    1   #include <openssl/ssl.h>
    2   int x;
END /tmp/ffconf.i4FhSrZW.c
gcc -m64 -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I../include/ -std=c99 -fomit-frame-pointer -fPIC -pthread -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -E -o /tmp/ffconf.BahB8tg0.o /tmp/ffconf.i4FhSrZW.c
check_func SSL_library_init -lssl -lcrypto
check_ld cc -lssl -lcrypto
check_cc
BEGIN /tmp/ffconf.i4FhSrZW.c
    1   extern int SSL_library_init();
    2   int main(void){ SSL_library_init(); }
END /tmp/ffconf.i4FhSrZW.c
gcc -m64 -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I../include/ -std=c99 -fomit-frame-pointer -fPIC -pthread -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -c -o /tmp/ffconf.BahB8tg0.o /tmp/ffconf.i4FhSrZW.c
gcc -m64 -L../lib/ -ldl -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.PMNLxDUz /tmp/ffconf.BahB8tg0.o -lssl -lcrypto -L/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/lib -lx264 -lpthread -lm -lvpx -lvpx -lvpx -lvpx -L/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/lib -lspeex -lopencore-amrwb -lopencore-amrnb -lmp3lame -lm -llzma -lz -pthread
../lib//libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
../lib//libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x334): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x3f2): undefined reference to `dlerror'
../lib//libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x464): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x522): undefined reference to `dlerror'
../lib//libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x589): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x5ed): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x625): undefined reference to `dlerror'
../lib//libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x6b1): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x711): undefined reference to `dlerror'
../lib//libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x772): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32
check_header openssl/ssl.h
check_cpp
BEGIN /tmp/ffconf.i4FhSrZW.c
    1   #include <openssl/ssl.h>
    2   int x;
END /tmp/ffconf.i4FhSrZW.c
gcc -m64 -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I../include/ -std=c99 -fomit-frame-pointer -fPIC -pthread -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -E -o /tmp/ffconf.BahB8tg0.o /tmp/ffconf.i4FhSrZW.c
check_func SSL_library_init -lssl32 -leay32
check_ld cc -lssl32 -leay32
check_cc
BEGIN /tmp/ffconf.i4FhSrZW.c
    1   extern int SSL_library_init();
    2   int main(void){ SSL_library_init(); }
END /tmp/ffconf.i4FhSrZW.c
gcc -m64 -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I../include/ -std=c99 -fomit-frame-pointer -fPIC -pthread -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -c -o /tmp/ffconf.BahB8tg0.o /tmp/ffconf.i4FhSrZW.c
gcc -m64 -L../lib/ -ldl -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.PMNLxDUz /tmp/ffconf.BahB8tg0.o -lssl32 -leay32 -L/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/lib -lx264 -lpthread -lm -lvpx -lvpx -lvpx -lvpx -L/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/lib -lspeex -lopencore-amrwb -lopencore-amrnb -lmp3lame -lm -llzma -lz -pthread
/usr/bin/ld: cannot find -lssl32
/usr/bin/ld: cannot find -leay32
collect2: error: ld returned 1 exit status
check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32
check_header openssl/ssl.h
check_cpp
BEGIN /tmp/ffconf.i4FhSrZW.c
    1   #include <openssl/ssl.h>
    2   int x;
END /tmp/ffconf.i4FhSrZW.c
gcc -m64 -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I../include/ -std=c99 -fomit-frame-pointer -fPIC -pthread -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -E -o /tmp/ffconf.BahB8tg0.o /tmp/ffconf.i4FhSrZW.c
check_func SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32
check_ld cc -lssl -lcrypto -lws2_32 -lgdi32
check_cc
BEGIN /tmp/ffconf.i4FhSrZW.c
    1   extern int SSL_library_init();
    2   int main(void){ SSL_library_init(); }
END /tmp/ffconf.i4FhSrZW.c
gcc -m64 -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I../include/ -std=c99 -fomit-frame-pointer -fPIC -pthread -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -I/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/include -c -o /tmp/ffconf.BahB8tg0.o /tmp/ffconf.i4FhSrZW.c
gcc -m64 -L../lib/ -ldl -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.PMNLxDUz /tmp/ffconf.BahB8tg0.o -lssl -lcrypto -lws2_32 -lgdi32 -L/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/lib -lx264 -lpthread -lm -lvpx -lvpx -lvpx -lvpx -L/home/bram/Downloads/javacpp-presets-0.10/ffmpeg/cppbuild/linux-x86_64/lib -lspeex -lopencore-amrwb -lopencore-amrnb -lmp3lame -lm -llzma -lz -pthread
/usr/bin/ld: cannot find -lws2_32
/usr/bin/ld: cannot find -lgdi32
collect2: error: ld returned 1 exit status
ERROR: openssl not found

@saudet
Copy link
Member

saudet commented Jan 20, 2015

That's strange, it seems to think it's cross-compiling for Windows. Could you try to append --target-os=linux (or something else if that's not right) to the configure line?

@CCarden
Copy link

CCarden commented Feb 8, 2015

If you haven't, try:
sudo apt-get install libssl-dev

More info:
https://help.ubuntu.com/community/OpenSSL

@beligum
Copy link
Contributor Author

beligum commented Feb 22, 2015

Hello,

(sorry for the slow response, I've been abroad)

Yes, the openssl dev package and all libs are installed correctly.

I've tracked down the problem: in ffmpeg/configure on line 4942, I had to add the "-ldl" linker flag in the first test line to make the configure script compile the ssl test correctly:

enabled openssl           && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -ldl ||
                               check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
                               check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
                               die "ERROR: openssl not found"; }

Apparently, the -ldl in the --extra-ldflags='-L../lib/ -ldl' configure flag doesn't make it through until that library test.

Any ideas how to fix this in a good/clean way?

b.

@saudet
Copy link
Member

saudet commented Feb 23, 2015 via email

@beligum
Copy link
Contributor Author

beligum commented Feb 23, 2015

Just ran the same command after a fresh git clone https://github.com/bytedeco/javacpp-presets and no, still the same problem. Here's my gcc version:

bram@escher:~/Downloads/javacpp-presets$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 
bram@escher:~/Downloads/javacpp-presets$

@saudet
Copy link
Member

saudet commented Feb 24, 2015

I've found the problem: We need to use the --extra-libs option to specify additional libraries, and that's working here. Check the commit above, let me know how that goes, and thanks for reporting!

@saudet
Copy link
Member

saudet commented Apr 11, 2015

Fix included in the -0.11 release. Thanks your time reporting and investigating this!

@saudet saudet closed this as completed Apr 11, 2015
mifi added a commit to mifi/ffmpeg-build-script that referenced this issue Aug 7, 2024
to remedy "ERROR: openssl not found"
bytedeco/javacpp-presets#32 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants