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

Cross-compiling not working #54

Open
t1456619 opened this issue Apr 17, 2019 · 0 comments
Open

Cross-compiling not working #54

t1456619 opened this issue Apr 17, 2019 · 0 comments

Comments

@t1456619
Copy link

t1456619 commented Apr 17, 2019

I tried to Cross-compile this library from linux to windows.
I modified the Makefile (ffmpeg30 part) as follow:

wget -O ffmpeg30.tar.bz2 http://ffmpeg.org/releases/ffmpeg-3.0.8.tar.bz2 mkdir ffmpeg30 && tar xf ffmpeg30.tar.bz2 -C ffmpeg30 --strip-components=1 && cd ffmpeg30 && ./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --prefix=/usr/local --disable-debug --enable-pthreads --enable-nonfree --enable-gpl --disable-indev=jack && make -j6 && sudo make install

and it all works good but when I try to compile the example with:

GOOS=windows GOARCH=386 CGO_ENABLED=1 CXX=i686-w64-mingw32-g++ CC=i686-w64-mingw32-gcc go build -tags ffmpeg30

i get the following error:

# github.com/imkira/go-libav/avutil /usr/local/lib/libavutil.a(log.o):log.c:(.text+0x1da): undefined reference to 'pthread_mutex_lock' /usr/local/lib/libavutil.a(log.o):log.c:(.text+0x69a): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x20): undefined reference to 'pthread_mutex_lock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x31): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x81): undefined reference to 'pthread_mutex_destroy' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x767): undefined reference to 'pthread_mutex_init' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x7f3): undefined reference to 'pthread_mutex_destroy' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x81f): undefined reference to 'pthread_mutex_lock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x8a6): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x956): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x968): undefined reference to 'pthread_mutex_unlock' collect2: error: ld returned 1 exit status

so I tried to modify the source adding some CFLAGS:

//#cgo CFLAGS: -pthread //#cgo CFLAGS: -lpthread //#cgo CFLAGS: -pedantic //#cgo CFLAGS: -Wextra //#cgo CFLAGS: -Wall //#include <pthread.h> //#include <lpthread.h> import "C"

I didn't read it was supposed to work on windows nor i did read the opposit tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant