Baka-MPlayer icon indicating copy to clipboard operation
Baka-MPlayer copied to clipboard

Custom toolchain; unable to find libmpv

Open DeadSix27 opened this issue 7 years ago • 4 comments

Trying to compile this in my custom toolchain, libmpv is compiled like:

./waf configure --enable-sdl2 --enable-libmpv-static

However when I configure Baka-MPlayer I get this error:

"Project ERROR: mpv development package not found"

Config line: (Note I setup a MXE toolchain just to compile QT5 and use a different toolchain for mpv and try to use it for Baka-Mplayer)


		QTROOT="/mxe/mxe/usr/x86_64-w64-mingw32.static/qt5/bin"
		QMAKE="$QTROOT/qmake" \
		./configure \
		"CONFIG+=embed_translations" \
		"lupdate=$QTROOT/lupdate" \
		"lrelease=$QTROOT/lrelease"

pkg-config finds it, shouldnt qmake too? Thats the part that confuses me:

$ pkg-config --print-provides mpv
mpv = 1.23.0
$ pkg-config --libs mpv
-L/f/toolchain/mingw-w64-x86_64/lib -lmpv

Any idea?

DeadSix27 avatar Nov 16 '16 09:11 DeadSix27

In the past, the primary issue with pkgbuild was mpv's pkgbuild not being generated properly. https://github.com/u8sand/Baka-MPlayer/blob/master/windows/cross-compilation/baka-build.sh#L113-L117

The fact that your pkg-config is working suggests otherwise. Perhaps it has something to do with an internal path of mxe's qmake. It may be using a different pkg-config than the one you intend. Ensure you're properly hiding everything in your path for the toolchain: https://github.com/u8sand/Baka-MPlayer/blob/master/windows/cross-compilation/baka-build.sh#L88-L98

Hopefully that helps

On Wed, Nov 16, 2016 at 4:24 AM, DeadSix27 [email protected] wrote:

Trying to compile this in my custom toolchain, libmpv is compiled like:

./waf configure --enable-sdl2 --enable-libmpv-static

However when I configure Baka-MPlayer I get this error:

"Project ERROR: mpv development package not found"

Config line: (Note I setup a MXE toolchain just to compile QT5 and use a different toolchain for mpv and try to use it for Baka-Mplayer)

  QTROOT="/mxe/mxe/usr/x86_64-w64-mingw32.static/qt5/bin"
  QMAKE="$QTROOT/qmake" \
  ./configure \
  "CONFIG+=embed_translations" \
  "lupdate=$QTROOT/lupdate" \
  "lrelease=$QTROOT/lrelease"

pkg-config finds it, shouldnt qmake too? Thats the part that confuses me:

$ pkg-config --print-provides mpv mpv = 1.23.0 $ pkg-config --libs mpv -L/f/toolchain/mingw-w64-x86_64/lib -lmpv

Any idea?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/u8sand/Baka-MPlayer/issues/231, or mute the thread https://github.com/notifications/unsubscribe-auth/ABR5pXrcvI3fPA6lA0JU5ppXemOBNQc5ks5q-svfgaJpZM4KzmAY .

u8sand avatar Nov 16 '16 12:11 u8sand

@u8sand

Newest edit: You should drop in the IRC too at some point, we can have a chat then.

I've made many edits in the time I tried to solve this, mainly as backup for me and in case someone else or you are interested in the whole process ;) However the most important edits are the first 3 I think

EDIT ( Probably one of the last ones):

I finally got around it, forgot you can add variables at the qmake line:

Like so:

"CONFIG+=embed_translations PKG_CONFIG=/mxe/mxe/usr/bin/x86_64-w64-mingw32.static-pkg-config LIBS+=-L/custom_toolchain..../lib INCPATH+=-I/custom_toolchain..../include" \
"lupdate=$QTROOT/lupdate" \
"lrelease=$QTROOT/lrelease"

EDIT(I stopped counting):

I got it to compile by definding: PKG_CONFIG = /mxe/mxe/usr/bin/x86_64-w64-mingw32.static-pkg-config and LIBS += -L/f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/lib and INCPATH += -I/f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/include in src/Baka-MPlayer.pro

Is there a way to set a ENV Var to allow "ld" in your compile script to have another lib dir ? maybe -L$extra_lib_dir and -I$extra_inc_dir or sommin? Unfortunately I wouldn't know how to do that myself, but so far those are the things (summarized) that made me successfully compile it:

  • give it a specific pkg-config binary path (PKG_CONFIG = [path] in Baka-MPlayer.pro)
  • give it a -L and -I directory by INCPATH/LIBS +=

(E.g the file Makefile.Release has: LIBS = .... -lglu32 -L/mxe.../ .... If there would be a -L$custom_lib_dir or so, that would totally fix my issue but that .Release file is auto generated of course.)


I fixed the pkg config myself as well in the script, its still semi broken, however as seen in the debug below, I still can't get it to work.

My paths are what seems to be correct in this situation I think:

PKG_CONFIG_PATH = /f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/lib/pkgconfig
PATH = /f/toolchain/mingw-w64-x86_64/bin:/home/****/bin:/home/****/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/extra/bin:/snap/bin

I will look into qmake and whether it has a special env var. for PKG CONFIG (Altho I think I searched that before and couldn't find anything)

EDIT: Also shouldn't it error out like:

Package mpv was not found in the pkg-config search path.
Perhaps you should add the directory containing `mpv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'mpv' found

The fact it doesn't, could mean it actually finds it, but can't find the specific files it needs in those dirs?

Do you know the files it requires? I have:

$ find /f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/ -name '*mpv*'
/f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libmpv.a
/f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libatmpvcno.a
/f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/lib/pkgconfig/mpv.pc
/f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/lib/libmpv.dll.a
/f/toolchain/mingw-w64-x86_64/x86_64-w64-mingw32/include/mpv

$ ls ./include/mpv
client.h  opengl_cb.h  qthelper.hpp  stream_cb.h

EDIT2: I removed the mpv.pc just to see what happends, same error: Project ERROR: mpv development package not found

ALSO:

DEBUG 2: variable PKGCONFIG_LIB => mpv
DEBUG 2: literal " development package not found"
DEBUG 2: evaluated expression => "mpv development package not found"
DEBUG 1: /mxe/mxe/usr/x86_64-w64-mingw32.static/qt5/mkspecs/features/link_pkgconfig.prf:10: calling built-in error("mpv development package not found")
Project ERROR: mpv development package not found

(I also added the libmpv files to the mxe toolchain before just to see, didn't make a difference)

More info that might help:

DEBUG 2: variable package => mpv
DEBUG 2: evaluated expression => "pkg-config 2> /dev/null 2> /dev/null --exists mpv"
DEBUG 1: /mxe/mxe/usr/x86_64-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf:270: calling built-in system("pkg-config 2> /dev/null 2> /dev/null --exists mpv")
DEBUG 1: /mxe/mxe/usr/x86_64-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf:270: test function returned false
DEBUG 1: /mxe/mxe/usr/x86_64-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf:270: AND
DEBUG 2: evaluating expression
DEBUG 2: new string
DEBUG 2: literal "false"

DeadSix27 avatar Nov 16 '16 18:11 DeadSix27

While I'm still not fully sure what's up with your toolchain, it could have to do with using libs built from another toolchain. Especially with static building this tends to bring problems.

Note that I've recently begun using this forked mxe repo: https://github.com/u8sand/mxe I've added mpv and baka-mplayer Makefiles to allow mxe to build baka by itself: (make baka-mplayer)

ARCH=(i686 x86_64)

if [ ! -d release ]; then
  mkdir -p release{,/{mpv,fonts}}

  cd release
  curl -L https://yt-dl.org/downloads/latest/youtube-dl.exe -o youtube-dl.exe

  cd fonts
  curl https://noto-website-2.storage.googleapis.com/pkgs/NotoSansSymbols-unhinted.zip | bsdtar -xvf -
  curl https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip | bsdtar -xvf -
  cd ..

  cd ..
fi

if [ ! -d build ]; then
  git clone [email protected]:u8sand/mxe.git build
  cat << EOF > build/settings.mk
JOBS := $(grep -c ^processor /proc/cpuinfo)
MXE_TARGETS := ${ARCH[@]/%/-w64-mingw32.static}
EOF
  cd build && make baka-mplayer
else
  cd build && git pull
  cd build && make update
fi

function upx_or_cp {
  upx $1 -o $2 || cp $1 $2
}

for arch in $ARCH; do
  mkdir -p $arch
  cp -r release/* $arch
  upx_or_cp "build/usr/$arch-w64-mingw32.static/bin/baka-mplayer.exe" "$arch/baka-mplayer.exe"
  cd $arch
  zip "../$arch.zip" -r *
  cd ..
  rm -r $arch
done

u8sand avatar Nov 22 '16 04:11 u8sand

The main deal being that I do not want to use MXE for MPV, FFMPEG etc, I use a toolchain script i forked of ffmpeg helpers, which is highly customized.

What I tried to do is compile JUST qt5 with mxe ('cuz thats a pain to do..) everything else I compile within my own toolchain.

Now with the last edit of my previous post I figured out how to compile your UI in my toolchain and it works just fine, Today I reset my entire toolchain and will check whether everything will work out automatically without issues.

In simple words: I figured out how to ""stand-alone"" compile your UI:

which is basically just:

		QTROOT="/mxe/mxe/usr/x86_64-w64-mingw32.static/qt5/bin"
		QMAKE="$QTROOT/qmake" \
		./configure \
		"CONFIG+=embed_translations PKG_CONFIG=/mxe/mxe/usr/bin/x86_64-w64-mingw32.static-pkg-config LIBS+=-L/cross_compilers/mingw-w64-x86_64/lib INCPATH+=-I/cross_compilers/mingw-w64-x86_64/include" \
		"lupdate=$QTROOT/lupdate" \
		"lrelease=$QTROOT/lrelease"
		make -j4

Altho I think I replaced the pkg config in the end with my toolchain one too, might be oudated, ill edit it later if nessesary.

DeadSix27 avatar Nov 30 '16 11:11 DeadSix27