-
Notifications
You must be signed in to change notification settings - Fork 535
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
Build SkiaSharp for Linux Arm #633
Comments
Ah, this might be taht your GCC is not the correct version... The What version of GCC are you using? |
Thanks for the quick response! gcc (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 I guess I don't need the newest SkiaSharp version though. I just need a 1.60.* version because my AvaloniaUI application doesn't work anymore after I updated Avalonia to the newest version. I guess their code depends on 1.60.*. I tried to build 1.60.1 as described in the Wiki but the branch isn't found anymore. Any idea? |
I get a similar error on Debian with gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 Maybe there is a misunderstanding on my side. I was under the impression that I could cross-compile SkiaSharp on an x64 system but probably that is not possible with the default gcc. Actually my first attempt was to compile it directly on my target ARM device (RPI) but there I get ./gn: cannot execute binary file: Exec format error |
Ah. I think I see what is happening, you must cross-compile, but you can't just use To do this, you need to specify the other flags - see the Customizing section of the wiki. You will have to add the See also: https://stackoverflow.com/questions/32359110/gcc-keeps-saying-mfpu-neon-is-an-unrecognoized-command |
Ok, sorry to bother you again. I found this https://github.com/raspberrypi/tools It compiled a few files and stopped with fontconfig.h could not be found.
The compiler in the tools says As I understand it, these are warnings that are treated as errors due to the |
Ah,we appear to be moving! This is the exact same issue, but for newer warnings. https://groups.google.com/forum/m/#!topic/skia-discuss/WybRL5GoVHI Basically, add In the next release, warnings are ignored for release builds by default, so this will soon not be needed. |
Thanks, that did the trick. After adding the missing libfontconfig.so, it finally built completely. I had hoped it would have been easier though. For Linux experts all the problems I faced (cross compilation, compiler version, missing packages, compiler and linker errors) may seem trivial but interestingly enough nobody on the web gives a clear description. I am just wondering because I think there could be done so many great things with .NET Core and this library (optionally via Avalonia UI) especially on ARM devices. It would really be helpful to have a subsection in the Wiki that goes a little into the details about building it for ARM. There seem to be quite a few people that want to get interesting projects done on a Raspberry Pi but I could imagine that many of them fail to build the library and use other tools. I could maybe set up a Github project for it myself but as I see it, a better place would be the Wiki. I know the Raspberry is just one platform, but wouldn't it be better nevertheless to have a working description for this one platform? Thanks again for your time and keep up the good work! |
Adding a step-by-step summary since it's taken me quite a while to work through this: # check out skia and depot_tools as per https://github.com/mono/SkiaSharp/wiki/Building-on-Linux
git clone git clone https://github.com/mono/skia.git -b v1.68.0-preview28
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
# check out RPI compilers as per https://github.com/mono/SkiaSharp/issues/633#issuecomment-420025558 and add to path
git clone https://github.com/raspberrypi/tools.git
export PATH="$PATH:<path-to-rpi-checkout>/tools/arm-bcm2708/arm-linux-gnueabihf/bin"
# installed libfontconfig on my RPI and then copied
# fcfreetype.h, fcprivate.h and fontconfig.h
# to
# <path-to-rpi-checkout>/tools/arm-bcm2708/arm-linux-gnueabihf/arm-linux-gnueabihf/include/fontconfig
# copied
# libfontconfig.a libfontconfig.so libfontconfig.so.1 libfontconfig.so.1.8.0
# to
# <path-to-rpi-checkout>/tools/arm-bcm2708/arm-linux-gnueabihf/arm-linux-gnueabihf/lib
# would it be possible to avoid the copy steps by installing libfontconfig:armhf directly on the build machine? I tried but couldn't get it to install
# change to skia directory - all work done here from now on
cd skia
# run git-sync-deps script (as per normal instructions)
python tools/git-sync-deps
# modified command line to use ARM cross-compilers from the RPI tools
./bin/gn gen 'out/linux/x64' --args='
cc = "arm-linux-gnueabihf-gcc"
cxx = "arm-linux-gnueabihf-g++"
is_official_build=true skia_enable_tools=false
target_os="linux" target_cpu="arm"
skia_use_icu=false skia_use_sfntly=false skia_use_piex=true
skia_use_system_expat=false skia_use_system_freetype2=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false
skia_enable_gpu=true
extra_cflags=[ "-DSKIA_C_DLL" ]
linux_soname_version="68.0.0"'
# compile
../depot_tools/ninja 'SkiaSharp' -C 'out/linux/x64' |
@LordBenjamin Thanks for this work! I will try and get this into a real cake target or as a separate script soon. Just an FYI, I copied your comment to #453 (comment) so that we can track all new linux platforms there. |
@mattleibow Glad it's useful! Hopefully having this scripted will make it a lot more accessible to others. |
:mips-interest |
Description
I try to build SkiaSharp for Linux Arm. I followed the Wiki here
https://github.com/mono/SkiaSharp/wiki/Building-on-Linux
I used the xamarin-mobile-bindings branch and followed the steps in the Wiki.
To create the build files I used
which is the command line from the Wiki but I replaced the target_cpu with arm.
Expected Behavior
Build the .so file without any error.
Actual Behavior
c++: error: unrecognized command line option ‘-mfpu=neon’
c++: error: unrecognized command line option ‘-mthumb’
At that point I am not Linux expert enough to know how to resolve it. The command line shown above does not specify these arguments so they must have been auto generated. Any idea?
Basic Information
The text was updated successfully, but these errors were encountered: