xiph / opusfile

Stand-alone decoder library for .opus streams
BSD 3-Clause "New" or "Revised" License
161 stars 82 forks source link

[Help] Compilation errors on Mingw64 #11

Closed Flix01 closed 6 years ago

Flix01 commented 6 years ago

Hello.

I'm cross-compiling opusfile for mingw64 (from Ubuntu 18.04 - 64bit through ./configure --host=x86_64-w64-mingw32) and I'm experiencing the following errors:

checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-w64-mingw32-gcc accepts -g... yes
checking for x86_64-w64-mingw32-gcc option to accept ISO C89... none needed
checking whether x86_64-w64-mingw32-gcc understands -c and -o together... yes
checking how to run the C preprocessor... x86_64-w64-mingw32-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-w64-mingw32-strip... x86_64-w64-mingw32-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking dependency style of x86_64-w64-mingw32-gcc... gcc3
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-w64-mingw32
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by x86_64-w64-mingw32-gcc... /usr/bin/x86_64-w64-mingw32-ld
checking if the linker (/usr/bin/x86_64-w64-mingw32-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/x86_64-w64-mingw32-nm -B
checking the name lister (/usr/bin/x86_64-w64-mingw32-nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-w64-mingw32 format... func_convert_file_nix_to_w32
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/x86_64-w64-mingw32-ld option to reload object files... -r
checking for x86_64-w64-mingw32-objdump... x86_64-w64-mingw32-objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for x86_64-w64-mingw32-dlltool... x86_64-w64-mingw32-dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for x86_64-w64-mingw32-ar... x86_64-w64-mingw32-ar
checking for archiver @FILE support... @
checking for x86_64-w64-mingw32-strip... (cached) x86_64-w64-mingw32-strip
checking for x86_64-w64-mingw32-ranlib... x86_64-w64-mingw32-ranlib
checking command to parse /usr/bin/x86_64-w64-mingw32-nm -B output from x86_64-w64-mingw32-gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for x86_64-w64-mingw32-mt... no
checking for mt... mt
configure: WARNING: using cross tools not prefixed with host triplet
checking if mt is a manifest tool... no
checking for dlfcn.h... no
checking for objdir... .libs
checking if x86_64-w64-mingw32-gcc supports -fno-rtti -fno-exceptions... no
checking for x86_64-w64-mingw32-gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if x86_64-w64-mingw32-gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if x86_64-w64-mingw32-gcc static flag -static works... yes
checking if x86_64-w64-mingw32-gcc supports -c -o file.o... yes
checking if x86_64-w64-mingw32-gcc supports -c -o file.o... (cached) yes
checking whether the x86_64-w64-mingw32-gcc linker (/usr/bin/x86_64-w64-mingw32-ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether make supports nested variables... (cached) yes
checking if x86_64-w64-mingw32-gcc supports -std=c89 flag... yes
checking if x86_64-w64-mingw32-gcc supports -pedantic flag... yes
checking if x86_64-w64-mingw32-gcc supports -Wall flag... yes
checking if x86_64-w64-mingw32-gcc supports -Wextra flag... yes
checking if x86_64-w64-mingw32-gcc supports -Wno-parentheses flag... yes
checking if x86_64-w64-mingw32-gcc supports -Wno-long-long flag... yes
checking if x86_64-w64-mingw32-gcc supports -U__STRICT_ANSI__ flag... yes
checking winsock2.h usability... yes
checking winsock2.h presence... yes
checking for winsock2.h... yes
checking for library containing ftime... none required
checking for x86_64-w64-mingw32-pkg-config... /usr/bin/x86_64-w64-mingw32-pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for URL_DEPS... yes
checking for DEPS... yes
checking for library containing lrintf... none required
checking for x86_64-w64-mingw32-gcc way to treat warnings as errors... -Werror
checking if x86_64-w64-mingw32-gcc supports __attribute__(( visibility("default") ))... yes
checking if x86_64-w64-mingw32-gcc supports -fvisibility=hidden... yes
checking for doxygen... no
checking for dot... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating opusfile.pc
config.status: creating opusurl.pc
config.status: creating opusfile-uninstalled.pc
config.status: creating opusurl-uninstalled.pc
config.status: creating doc/Doxyfile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure:
------------------------------------------------------------------------
  opusfile 0.9: Automatic configuration OK.

    Assertions ................... no

    HTTP support ................. yes
    Fixed-point .................. no
    Floating-point API ........... yes
    Library for lrintf() ......... none required

    Hidden visibility ............ yes

    API code examples ............ yes
    API documentation ............ yes
------------------------------------------------------------------------

make  all-am
make[1]: Entering directory '/mnt/93a73f20-dd00-4964-a118-fabad96ec1bd/Repositories/xiph/opus/opusfile-0.9'
  CC       src/info.lo
  CC       src/internal.lo
  CC       src/opusfile.lo
  CC       src/stream.lo
  CC       src/libopusurl_la-http.lo
  CC       src/libopusurl_la-internal.lo
In file included from /home/flix/Mingw64/include/openssl/ssl.h:48:0,
                 from src/http.c:216:
src/http.c: In function ‘op_bio_retry_ctrl’:
/home/flix/Mingw64/include/openssl/bio.h:193:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
                 BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/flix/Mingw64/include/openssl/bio.h:193:17: note: in definition of macro ‘BIO_clear_retry_flags’
                 BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
                 ^~~~~~~~~~~~~~~
src/http.c:1522:5: note: here
     case BIO_CTRL_EOF:
     ^~~~
  CC       src/libopusurl_la-wincerts.lo
src/wincerts.c: In function ‘op_capi_new’:
src/wincerts.c:42:8: error: dereferencing pointer to incomplete type ‘X509_LOOKUP {aka struct x509_lookup_st}’
     _lu->method_data=(char *)h_store;
        ^~
src/wincerts.c: In function ‘op_capi_retrieve_by_subject’:
src/wincerts.c:61:3: warning: implicit declaration of function ‘CRYPTO_w_lock’; did you mean ‘CRYPTO_zalloc’? [-Wimplicit-function-declaration]
   CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
   ^~~~~~~~~~~~~
   CRYPTO_zalloc
src/wincerts.c:61:17: error: ‘CRYPTO_LOCK_X509_STORE’ undeclared (first use in this function); did you mean ‘CRYPTO_EX_INDEX_X509_STORE’?
   CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
                 ^~~~~~~~~~~~~~~~~~~~~~
                 CRYPTO_EX_INDEX_X509_STORE
src/wincerts.c:61:17: note: each undeclared identifier is reported only once for each function it appears in
src/wincerts.c:63:3: warning: implicit declaration of function ‘CRYPTO_w_unlock’; did you mean ‘CRYPTO_realloc’? [-Wimplicit-function-declaration]
   CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
   ^~~~~~~~~~~~~~~
   CRYPTO_realloc
src/wincerts.c:65:9: error: dereferencing pointer to incomplete type ‘X509_OBJECT {aka struct x509_object_st}’
     _ret->type=obj->type;
         ^~
src/wincerts.c: In function ‘op_capi_get_by_subject’:
src/wincerts.c:76:11: error: dereferencing pointer to incomplete type ‘X509_NAME {aka struct X509_name_st}’
   if(_name->bytes==NULL||_name->bytes->length<=0||_name->modified){
           ^~
src/wincerts.c: At top level:
src/wincerts.c:147:1: error: variable ‘X509_LOOKUP_CAPI’ has initializer but incomplete type
 static X509_LOOKUP_METHOD X509_LOOKUP_CAPI={
 ^~~~~~
src/wincerts.c:148:3: warning: excess elements in struct initializer
   "Load Crypto API store into cache",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wincerts.c:148:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:149:3: warning: excess elements in struct initializer
   op_capi_new,
   ^~~~~~~~~~~
src/wincerts.c:149:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:150:3: warning: excess elements in struct initializer
   op_capi_free,
   ^~~~~~~~~~~~
src/wincerts.c:150:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:151:3: warning: excess elements in struct initializer
   NULL,
   ^~~~
src/wincerts.c:151:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:152:3: warning: excess elements in struct initializer
   NULL,
   ^~~~
src/wincerts.c:152:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:153:3: warning: excess elements in struct initializer
   NULL,
   ^~~~
src/wincerts.c:153:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:154:3: warning: excess elements in struct initializer
   op_capi_get_by_subject,
   ^~~~~~~~~~~~~~~~~~~~~~
src/wincerts.c:154:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:155:3: warning: excess elements in struct initializer
   NULL,
   ^~~~
src/wincerts.c:155:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:156:3: warning: excess elements in struct initializer
   NULL,
   ^~~~
src/wincerts.c:156:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:157:3: warning: excess elements in struct initializer
   NULL
   ^~~~
src/wincerts.c:157:3: note: (near initialization for ‘X509_LOOKUP_CAPI’)
src/wincerts.c:147:27: error: storage size of ‘X509_LOOKUP_CAPI’ isn’t known
 static X509_LOOKUP_METHOD X509_LOOKUP_CAPI={
                           ^~~~~~~~~~~~~~~~
Makefile:671: recipe for target 'src/libopusurl_la-wincerts.lo' failed
make[1]: *** [src/libopusurl_la-wincerts.lo] Error 1
make[1]: *** Waiting for unfinished jobs....

Similar errors seem to be reported here: https://aur.archlinux.org/packages/mingw-w64-opusfile/

However it's not clear to me when I should use --disable-http to fix them, or if there is a version problem...

Any help ?

P.S. I'm using openssl-1.1.0i-win64-mingw and opusfile-0.9 or opusfile-master (same errors AFAICR).

Flix01 commented 6 years ago

[Solved] --disable-http had to be added to configure this way:

./configure --disable-http --host=x86_64-w64-mingw32 instead of: ./configure --host=x86_64-w64-mingw32.

P.S. Although it probably disables some features, it's OK for me and I hope it helps others :smile: .

rillian commented 6 years ago
src/wincerts.c: In function ‘op_capi_new’:
src/wincerts.c:42:8: error: dereferencing pointer to incomplete type ‘X509_LOOKUP {aka struct x509_lookup_st}’
     _lu->method_data=(char *)h_store;

This looks like the winsock headers on your system aren't complete. Did you try mingw/Makefile? That uses the unix makefile instead of the autoconf build; maybe there's some option we're missing. It does a 32-bit build assuming a Fedora environment, but it should be easy to change the tool prefix.

Flix01 commented 6 years ago

Did you try mingw/Makefile? That uses the unix makefile instead of the autoconf build; maybe there's some option we're missing. It does a 32-bit build assuming a Fedora environment, but it should be easy to change the tool prefix.

@rillian: I've just tried it and it seems to work. It downloads and builds: libogg-1.3.2.tar.xz, openssl-1.0.2l.tar.gz and opus-1.2.1.tar.gz. All I had to do in Makefile was to replace: i686 with x86_64 and then I also commented out these lines:

#   cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll $@
#   cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll $@

because they are not present on my system (but I can easily search and copy these dlls manually later).

Thanks for your help and your quick reply :smiley: !

rillian commented 6 years ago

Ok, great, that's probably a better work-around than disabling network support. Thanks for checking!