-
Notifications
You must be signed in to change notification settings - Fork 86
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
can't compile it for windows on linux #4
Comments
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. |
did you have any luck compiling libraries? |
They both compile fine on Fedora 25, but I have no way to test them. |
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 |
I followed these guides: ffmpeg: https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW |
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 then I just setted PKG_CONFIG_PATH variable to my pkg-config files and proceded to compile hacktv [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 Thanks for Anwsering and Best Regards [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 |
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 I feel souch and idiot right now (because I complained about simple stuff) but at least I learned something new 😄 |
Hi after getting hacktv working on linux I decided to try and compile it for windows since I have a hard time compiling c on windows I decided to try to compile hacktv for windows on linux using mingw cross-compiler
I followed this tutorial: https://arrayfire.com/cross-compile-to-windows-from-linux/
and changed makefile from this
to this:
but when running make I get a weird error (it didn't complain about libraries which I assumed):
I would realy like to compile this for windows because I can't use my HackRF in a VM and its unpractical to boot to linux just to have a play with an awesome project I dream about when I got my HackRF One
Thanks for Anwsering and Best Regards
The text was updated successfully, but these errors were encountered: