hlsdl icon indicating copy to clipboard operation
hlsdl copied to clipboard

Lots of errors/warnings trying to compile with GCC 7.2.0

Open Reino17 opened this issue 8 years ago • 7 comments

With FFmpeg and Curl installed I was trying to compile hlsdl with GCC 7.2.0, but I received LOTS of errors/warnings: https://pastebin.com/vSUiv5hg (too much to copy-paste here).

Reino17 avatar Oct 29 '17 19:10 Reino17

Really not sure what’s going on, all these errors are in library files that should be okay.

selsta avatar Oct 29 '17 19:10 selsta

Closing due to no answer. If this still happens, create a new issue please.

selsta avatar Dec 26 '17 23:12 selsta

No answer to what? Where's the question?

Reino17 avatar Dec 27 '17 21:12 Reino17

Oops, sorry.

selsta avatar Dec 27 '17 21:12 selsta

Getting back at this, in 'makefile' I noticed:

CC?=gcc
PREFIX?=/usr/local

Since I'm cross-compiling I had to do:

make "CC=/cygdrive/m/ffmpeg-windows-build-helpers-master/ffmpeg_local_builds/sandbox/cross_co
mpilers/mingw-w64-i686/bin/i686-w64-mingw32-gcc PREFIX=/cygdrive/m/ffmpeg-windows-build-helpe
rs-master/ffmpeg_local_builds/sandbox/cross_compilers/mingw-w64-i686/i686-w64-mingw32"

That solved the initial issue, but then I got:

/cygdrive/m/[...]/bin/i686-w64-mingw32-gcc src/main.o src/aes.o src/curl.o src/hls.o src/misc
.o src/msg.o -L/cygdrive/m/[...]/i686-w64-mingw32/lib -lcurl -lavformat [...] -ladvapi32 -o h
lsdl
/cygdrive/m/[...]/i686-w64-mingw32/lib/libcurl.a(libcurl_la-ldap.o):ldap.c:(.text+0x158): und
efined reference to `_imp__ldap_err2string'
[...]
/cygdrive/m/[...]/i686-w64-mingw32/lib/libcurl.a(libcurl_la-ldap.o):ldap.c:(.text+0xf34): und
efined reference to `_imp__ldap_memfree'
collect2: error: ld returned 1 exit status
make: *** [makefile:25: all] Error 1

In the end I solved that by updating 'makefile' a bit:

diff --git a/makefile b/makefile
index 30f9465..5962b7c 100644
--- a/makefile
+++ b/makefile
@@ -13,7 +13,7 @@ CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
 CFLAGS+=-Wsign-compare -Iincludes -g
 CFLAGS+=-DPREFIX='"$(PREFIX)"'
 CFLAGS+=$(shell $(PKGCONFIG) --cflags)
-LDFLAGS=$(shell $(PKGCONFIG) --libs)
+LDFLAGS=$(shell $(PKGCONFIG) --static --libs)

 OSNAME=$(shell uname -s | sed -e 's/[-_].*//g' | tr A-Z a-z)
 ifeq ("$(OSNAME)", "linux")

Why? Because...

$ pkg-config --static --libs libcurl
-L/cygdrive/m/[...]/i686-w64-mingw32/lib -lcurl -lnettle -lgnutls -lws2_32 -lgmp -lcrypt32 -l
hogweed -lgmp -lnettle -lwldap32 -lz -lws2_32

also returns libcurl's private libs, unlike...

$ pkg-config --libs libcurl
-L/cygdrive/m/[...]/i686-w64-mingw32/lib -lcurl

Reino17 avatar Apr 15 '18 22:04 Reino17

And in case you're eager to fix warnings:

/cygdrive/m/[...]/bin/i686-w64-mingw32-gcc -march=pentium3 -O2 -mfpmath=sse -msse -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare -Iincludes -g -DPREFIX='"/cygdrive/m/[...]/i686-w64-mingw32"' -DCURL_STATICLIB -I/cygdrive/m/[...]/i686-w64-mingw32/include -c src/main.c -o src/main.o
src/main.c: In function 'main':
src/main.c:25:5: warning: 'av_register_all' is deprecated [-Wdeprecated-declarations]
     av_register_all();
     ^~~~~~~~~~~~~~~
In file included from src/main.c:1:0:
/cygdrive/m/[...]/i686-w64-mingw32/include/libavformat/avformat.h:2025:6: note: declared here
 void av_register_all(void);
      ^~~~~~~~~~~~~~~
/cygdrive/m/[...]/bin/i686-w64-mingw32-gcc -march=pentium3 -O2 -mfpmath=sse -msse -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare -Iincludes -g -DPREFIX='"/cygdrive/m/[...]/i686-w64-mingw32"' -DCURL_STATICLIB -I/cygdrive/m/[...]/i686-w64-mingw32/include -c src/aes.c -o src/aes.o
src/aes.c: In function 'AES128_CBC_encrypt_buffer':
src/aes.c:492:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
     Iv = (uint8_t*)iv;
          ^
src/aes.c:495:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i = 0; i < length; i += KEYLEN)
                ^
src/aes.c: In function 'AES128_CBC_decrypt_buffer':
src/aes.c:533:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
     Iv = (uint8_t*)iv;
          ^
src/aes.c:536:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i = 0; i < length; i += KEYLEN)
                ^
/cygdrive/m/[...]/bin/i686-w64-mingw32-gcc -march=pentium3 -O2 -mfpmath=sse -msse -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare -Iincludes -g -DPREFIX='"/cygdrive/m/[...]/i686-w64-mingw32"' -DCURL_STATICLIB -I/cygdrive/m/[...]/i686-w64-mingw32/include -c src/hls.c -o src/hls.o
src/hls.c: In function 'decrypt_sample_aes':
src/hls.c:418:5: warning: 'codec' is deprecated [-Wdeprecated-declarations]
     ofmt_ctx->streams[audio_idx]->codec->frame_size = audio_frame_size;
     ^~~~~~~~
In file included from src/hls.c:1:0:
/cygdrive/m/[...]/i686-w64-mingw32/include/libavformat/avformat.h:877:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
src/hls.c:489:21: warning: implicit declaration of function 'memmem'; did you mean 'memset'? [-Wimplicit-function-declaration]
                 p = memmem(p, (end - p), h264_nal_init, 3);
                     ^~~~~~
                     memset
src/hls.c:489:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
                 p = memmem(p, (end - p), h264_nal_init, 3);
                   ^
src/hls.c:493:25: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
                 nal_end = memmem(p + 3, (end - (p + 3)), h264_nal_init, 3);
                         ^
src/hls.c:505:37: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
                         while ((tmp = memmem(tmp, nal_end - tmp,
                                     ^
src/hls.c:518:29: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
                     nal_end = memmem(p, (end - p), h264_nal_init, 3);
                             ^

Reino17 avatar Apr 15 '18 23:04 Reino17

Hi, thanks! I’ll update the makefile.

selsta avatar May 18 '18 12:05 selsta