Coder Social home page Coder Social logo

Comments (7)

fsphil avatar fsphil commented on July 22, 2024

The error you're seeing looks like a gcc or libc issue. I did try compiling it with mingw64 on my machine (Fedora 25 x86_64) and it complains about the libraries as expected.

If I disable ffmpeg and libhackrf it produces hackrf.exe, but it won't be much use to anyone without those two libraries :) I may try building those later.

from hacktv.

veso266 avatar veso266 commented on July 22, 2024

did you have any luck compiling libraries?

from hacktv.

fsphil avatar fsphil commented on July 22, 2024

They both compile fine on Fedora 25, but I have no way to test them.
I didn't try building hacktv with them either.

from hacktv.

veso266 avatar veso266 commented on July 22, 2024

If you manage to compile hacktv with them I would be happy to test it

PS: do you think you can post steps you took to compile them? (and how to link them to hacktv)

Thanks for Anwsering and Best Regards

from hacktv.

fsphil avatar fsphil commented on July 22, 2024

I followed these guides:

ffmpeg: https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW
libhackrf: https://github.com/mossmann/hackrf/tree/master/host

from hacktv.

veso266 avatar veso266 commented on July 22, 2024

Thanks for instructions

after installing Fedora 26 64 Bit into a VM, installing MinGW (and everything that comes with it (I used apper package manager to install everything that had mingw64 in it) and I also installed mingw64-gsl so I got Mingw version of pkg-config

then I compiled this version of libhackrf (I didn't use the latest version because it has hackrf_sweep which requires FFTW3 and I could not compile it) (which version of libhackrf did you used for development?) with MinGW per instructions: https://github.com/mossmann/hackrf/releases/download/v2015.07.2/hackrf-2015.07.2.tar.xz
and found ffmpeg libs for windows online: https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-20170913-ec1573f-win64-dev.zip

then I just setted PKG_CONFIG_PATH variable to my pkg-config files and proceded to compile hacktv
it went well (some warnings in ffmpeg.c) until it hitted hackrf.c part where it started to complain

[mitja@localhost hacktv]$ make
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c hacktv.c -o hacktv.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c video.c -o video.o
video.c: In function 'vid_next_line':
video.c:1046:30: warning: 'lut_b' may be used uninitialized in this function [-Wmaybe-uninitialized]
    s->output[x * 2] += (lut_b[x] * s->burst_level) >> 16;
                              ^
video.c:972:8: warning: 'seq' may be used uninitialized in this function [-Wmaybe-uninitialized]
  if(seq[0] == 'v') w = s->vsync_short_width;
     ~~~^~~
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c videocrypt.c -o videocrypt.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c nicam728.c -o nicam728.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c test.c -o test.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c ffmpeg.c -o ffmpeg.o
ffmpeg.c: In function '_av_ffmpeg_read_video':
ffmpeg.c:142:3: warning: 'avcodec_decode_video2' is deprecated [-Wdeprecated-declarations]
   avcodec_decode_video2(av->video_codec_ctx, av->frame, &i, &packet);
   ^~~~~~~~~~~~~~~~~~~~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:4971:5: note: declared here
 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
     ^~~~~~~~~~~~~~~~~~~~~
ffmpeg.c: In function '_av_ffmpeg_read_audio':
ffmpeg.c:190:3: warning: 'avcodec_decode_audio4' is deprecated [-Wdeprecated-declarations]
   avcodec_decode_audio4(av->audio_codec_ctx, av->frame, &i, &packet);
   ^~~~~~~~~~~~~~~~~~~~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:4922:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
ffmpeg.c:205:10: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
    frame = av->frame_s16[0];
          ^
ffmpeg.c: In function 'av_ffmpeg_open':
ffmpeg.c:275:3: warning: 'codec' is deprecated [-Wdeprecated-declarations]
   if(av->video_stream == NULL && av->format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
   ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
ffmpeg.c:280:3: warning: 'codec' is deprecated [-Wdeprecated-declarations]
   if(av->audio_stream == NULL && av->format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
   ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
ffmpeg.c:295:2: warning: 'codec' is deprecated [-Wdeprecated-declarations]
  av->video_codec_ctx = av->video_stream->codec;
  ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
ffmpeg.c:325:2: warning: 'avpicture_get_size' is deprecated [-Wdeprecated-declarations]
  len = avpicture_get_size(AV_PIX_FMT_RGB32, s->active_width, s->conf.active_lines);
  ^~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:5631:5: note: declared here
 int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
     ^~~~~~~~~~~~~~~~~~
ffmpeg.c:336:2: warning: 'avpicture_fill' is deprecated [-Wdeprecated-declarations]
  avpicture_fill((AVPicture *) av->frame_rgb, buffer, AV_PIX_FMT_RGB32, s->active_width, s->conf.active_lines);
  ^~~~~~~~~~~~~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:5616:5: note: declared here
 int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
     ^~~~~~~~~~~~~~
ffmpeg.c:357:3: warning: 'codec' is deprecated [-Wdeprecated-declarations]
   av->audio_codec_ctx = av->audio_stream->codec;
   ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c hackrf.c -o hackrf.o
hackrf.c:207:12: error: conflicting types for '_write'
 static int _write(void *private, int16_t *iq_data, size_t samples)
            ^~~~~~
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
                 from hackrf.c:23:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:225:23: note: previous declaration of '_write' was here
   _CRTIMP int __cdecl _write(int _FileHandle,const void *_Buf,unsigned int _MaxCharCount);
                       ^~~~~~
hackrf.c:232:12: error: conflicting types for '_close'
 static int _close(void *private)
            ^~~~~~
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
                 from hackrf.c:23:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:192:23: note: previous declaration of '_close' was here
   _CRTIMP int __cdecl _close(int _FileHandle);
                       ^~~~~~
make: *** [Makefile:20: hackrf.o] Error 1

and here is hacktv I tried to compile: http://upload.dxing.si/server/php/files/hacktv.7z
I modified MakeFile (changed compiler (gcc to x86_64-w64-mingw32-gcc and pkg-config to mingw64-pkg-config), hackrf.c (changed #include <libhackrf/hackrf.h> to #include "includes/libhackrf/hackrf.h" (PS: what's the diference if you include some header files with <> or with "" (because if I tried to include hackrf.h with <> compiler complained that it can't find hackrf.h)), ffmpeg.c (replaced #include <> with "" (because compiler complained otherwise)

Thanks for Anwsering and Best Regards
BTW: when running
x86_64-w64-mingw32-gcc -v I get this version:

[mitja@localhost hacktv]$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-languages=c,c++,objc,obj-c++,fortran --with-bugurl=http://bugzilla.redhat.com/bugzilla --with-cloog --enable-threads=posix --enable-libgomp --target=x86_64-w64-mingw32 --with-sysroot=/usr/x86_64-w64-mingw32/sys-root --with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
Thread model: posix
gcc version 7.2.0 20170814 (Fedora MinGW 7.2.0-1.fc26) (GCC) 

and when running normal gcc version check with gcc -v I get a bit older version:

[mitja@localhost hacktv]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.1.1 20170622 (Red Hat 7.1.1-3) (GCC) 

so maybe my compiler is too new but that's strange that minor difference between compilers would break code

from hacktv.

veso266 avatar veso266 commented on July 22, 2024

well after learning a bit of c 😄 and a few month later I tried again and it finaly compiled (just had to rename _write and _close to something else (_writeRF and _closeRF) as they were already declared with that name in io.h and unistd.h in MinGW)

also have to change gmtime_r to gmtime_s in teletext.c because windows doesn't have gmtime_r
https://stackoverflow.com/questions/19051762/difference-between-gmtime-r-and-gmtime-s

I feel souch and idiot right now (because I complained about simple stuff) but at least I learned something new 😄

from hacktv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.