Page 1 of 1

Cross-compiling

Posted: April 7th, 2017, 1:59 am
by tremby
Is there any recommended guide on how to cross-compile MPD? I don't know much about build systems and compilation -- I've just always run ./configure (and installed any dependencies it complained that I was missing until that succeeded) and then make, and it's gone OK. Obviously that's just for the local system.

I'd now like to compile on my main (fast) workstation (running Ubuntu 16.04) for my Raspberry Pi 3 (Linux osmcpi 4.4.27-9-osmc #1 SMP PREEMPT Tue Mar 14 20:54:19 UTC 2017 armv7l GNU/Linux -- running OSMC, which is based on Debian).

What I don't want to do is pollute my workstation with a bunch of globally-installed dependencies, so I figure maybe a VM would be the answer, or perhaps there's some natively-running tool I'm unaware of which can partition a separate environment where all the necessary tools and dependencies can be.

One thing I'm worried about is how the dependencies work -- would I need the same versions of the dependencies on both machines? Or would I compile everything into a static chunk on the workstation? If that's a choice, what are the pros and cons each way?

I'd love to hear any recommendations.

Re: Cross-compiling

Posted: April 7th, 2017, 6:39 am
by max
There is nothing special with MPD regarding cross-compilation. MPD uses autotools, and autotools suports cross-compilation very well. The problems you need to solve are thus pretty generic. Collecting all the host dependencies on the build machine is, of course, the hardest part. You need compatible versions of those host libraries. Maybe the easiest way to do that is to have a copy of your Rpi filesystem (with all required -dev packages installed) on your build machine.

Re: Cross-compiling

Posted: June 3rd, 2017, 1:43 pm
by Souti
I tried to compile for windows under Ubuntu but compilation fails with this error :

I launched the command ./win32/build.py --64 from last git clone repository.

CXX src/lib/icu/libicu_a-Win32.o
CXX src/mixer/plugins/libmixer_plugins_a-WinmmMixerPlugin.o
CXX src/output/liboutput_plugins_a-Timer.o
CXX src/output/plugins/liboutput_plugins_a-NullOutputPlugin.o
CXX src/output/plugins/liboutput_plugins_a-RecorderOutputPlugin.o
CXX src/output/plugins/httpd/liboutput_plugins_a-Page.o
CXX src/lib/xiph/libxiph_a-VorbisComments.o
CXX src/output/plugins/httpd/liboutput_plugins_a-IcyMetaDataServer.o
CXX src/lib/xiph/libxiph_a-XiphTags.o
CXX src/output/plugins/liboutput_plugins_a-WinmmOutputPlugin.o
CXX src/output/plugins/httpd/liboutput_plugins_a-HttpdClient.o
CXX src/output/plugins/httpd/liboutput_plugins_a-HttpdOutputPlugin.o
CXX src/lib/xiph/libxiph_a-OggVisitor.o
CXX src/lib/xiph/libxiph_a-OggSyncState.o
CXX src/lib/xiph/libxiph_a-OggFind.o
CXX src/lib/xiph/libxiph_a-OggPacket.o
CXX src/storage/libstorage_a-Registry.o
CXX src/storage/libstorage_a-StorageInterface.o
CXX src/storage/libstorage_a-CompositeStorage.o
In file included from ./src/util/StringAPI.hxx:38:0,
from ./src/fs/Traits.hxx:26,
from ./src/fs/AllocatedPath.hxx:25,
from src/storage/StorageInterface.cxx:22:
./src/util/WStringAPI.hxx: In function ‘wchar_t* UnsafeCopyStringP(wchar_t*, const wchar_t*)’:
./src/util/WStringAPI.hxx:110:26: error: ‘wcpcpy’ was not declared in this scope
return wcpcpy(dest, src);
^
In file included from ./src/fs/Traits.hxx:26:0,
from ./src/fs/AllocatedPath.hxx:25,
from src/storage/StorageInterface.cxx:22:
./src/util/StringAPI.hxx: In function ‘char* UnsafeCopyStringP(char*, const char*)’:
./src/util/StringAPI.hxx:119:25: error: ‘stpcpy’ was not declared in this scope
return stpcpy(dest, src);
^
In file included from ./src/util/StringAPI.hxx:38:0,
from ./src/fs/Traits.hxx:26,

Re: Cross-compiling

Posted: June 3rd, 2017, 7:10 pm
by max
Which mingw-w64 version?

Re: Cross-compiling

Posted: June 3rd, 2017, 7:15 pm
by Souti
Seems to be 4.0.4-2

Re: Cross-compiling

Posted: June 7th, 2017, 11:27 am
by max
Which is outdated.

Re: Cross-compiling

Posted: June 7th, 2017, 11:46 am
by Souti
Thanks do you know which linux distrib and version is better to do the cross compilation ?

Re: Cross-compiling

Posted: June 7th, 2017, 8:00 pm
by max
I use Debian Stretch. I wouldn't touch Ubuntu with a long pole, but that's just my taste.