flatpak / flatpak-builder

Tool to build flatpaks from source
GNU Lesser General Public License v2.1
139 stars 91 forks source link

Multilib builds #138

Closed johnramsden closed 5 years ago

johnramsden commented 6 years ago

I'm having trouble getting multilib builds to work on my flatpak https://github.com/johnramsden/pathofexile-flatpak/pull/4 . I was wondering what I'm doing wrong.

I keep getting an error during builds that "checking whether gcc -m32 works... no". I think I may have set up the app-build-extension wrong, but there's not a lot of information out there, and I'm not very experienced in the area. How exactly should I be using the dynamic linker, and is related to this problem? I'm currently setting it up with the following:

"build-commands": [
   "ln -s /app/lib/32bit/lib/ld-linux.so.2 /app/lib/ld-linux.so.2",
   "install -Dm644 ld.so.conf /app/etc/ld.so.conf"
],

I'm then building a WoW64 build of wine, it builds the 64-bit wine successfully, but it fails at the 32-bit step.

Are there any good examples showing a multilib build with builder? I think an entry in the wiki describing how to do multilib builds properly would be very useful.

julianrichen commented 6 years ago

org.freedesktop.Platform.Compat32 is the i386 Platform bundled as an x86_64 extension. So it won't have the build tools like 32bit gcc & the headers in it since it's stripped out.

$ cd /var/lib/flatpak/runtime/org.freedesktop.Platform.Compat32/x86_64/1.6/active/files
$ ls -la bin | grep gcc
[ nothing :( ]
$ ls -la include
total 16
drwxr-xr-x.  4 root root 4096 Dec 31  1969 .
drwxr-xr-x. 12 root root 4096 May 15 11:59 ..
drwxr-xr-x.  2 root root 4096 Dec 31  1969 python2.7
drwxr-xr-x.  2 root root 4096 Dec 31  1969 python3.5m

You will probably be interested in flatpak/freedesktop-sdk-images/issues/101, I'm also building wine like you but as a runtime instead of an app.

I've tried several hacky solutions but having a proper Compat32 Sdk extension would be good. I'm not sure how complicated it as (if other stuff is done behind the scenes) but looking at: latpak/freedesktop-sdk-images/blob/1.6/Makefile#L84 adding the following to the Makefile might work:

if test "${ARCH}" = "i386" -a -f ${REPO}/refs/heads/runtime/org.freedesktop.Sdk/i386/${SDK_BRANCH}; then \
    flatpak build-commit-from ${EXPORT_ARGS} --src-ref=runtime/org.freedesktop.Sdk/${ARCH}/${SDK_BRANCH} ${REPO} runtime/org.freedesktop.Sdk.Compat32/x86_64/${SDK_BRANCH} ; \
fi