LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Difficulty compiling multilib packages that depend on python3. (https://www.linuxquestions.org/questions/slackware-14/difficulty-compiling-multilib-packages-that-depend-on-python3-4175661280/)

brokenshakles 09-21-2019 10:52 PM

Difficulty compiling multilib packages that depend on python3.
 
As part of setting up wayland and xwayland, I'm trying to (re)compile atk and friends on a Slackware64-Multilib system. I've been doing well so far, but trying to get gobject-introspection to compile causes barfing on a python3 header: https://pastebin.com/z4TTVZYe

Anyone know how to get this dep working for a multilib compile?

Alien Bob 09-22-2019 06:21 AM

This needs to be fixed in the Slackware python3 package itself.
The pyconfig.h header file is not multilib-ready and it should be renamed based on whether you build a 32bit or a 64bit package. Then a wrapper pyconfig.h should be put in its place which includes the appropriate pyconfig header for the architecture.

I can not fix this in my multilib repository where I do nothing more but re-packaging the 32bit Slackware packages.

ponce 09-22-2019 09:23 AM

fedora does like this in their python3.spec
Code:

[...]
# For multilib support, files that are different between 32- and 64-bit arches
# need different filenames. Use "64" or "32" according to the word size.
# Currently, the best way to determine an architecture's word size happens to
# be checking %%{_lib}.
%if "%{_lib}" == "lib64"
%global wordsize 64
%else
%global wordsize 32
%endif
[...]
# Multilib support for pyconfig.h
# 32- and 64-bit versions of pyconfig.h are different. For multilib support
# (making it possible to install 32- and 64-bit versions simultaneously),
# we need to install them under different filenames, and to make the common
# "pyconfig.h" include the right file based on architecture.
# See https://bugzilla.redhat.com/show_bug.cgi?id=192747
# Filanames are defined here:
%global _pyconfig32_h pyconfig-32.h
%global _pyconfig64_h pyconfig-64.h
%global _pyconfig_h pyconfig-%{wordsize}.h
[...]
# Make python3-devel multilib-ready
  mv %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h \
    %{buildroot}%{_includedir}/python${LDVersion}/%{_pyconfig_h}
  cat > %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h << EOF
#include <bits/wordsize.h>

#if __WORDSIZE == 32
#include "%{_pyconfig32_h}"
#elif __WORDSIZE == 64
#include "%{_pyconfig64_h}"
#else
#error "Unknown word size"
#endif
EOF
[...]


Alien Bob 09-22-2019 10:11 AM

You could check with Pat whether he is willing to add this multilib support to the python3 package.
It will however have a larger chance of success if you provide a patch which produces the desired result, so he does not have to do the research for you.

orbea 09-22-2019 10:58 AM

Here is a quick patch for Pat's python3 SlackBuild based on the fedora spec file above, but I am not sure how to test the original issue. I am also not sure its correct for s390, arm or armel, but I have no way of testing those.

Code:

--- python3.SlackBuild.orig        2019-09-22 08:35:06.042816493 -0700
+++ python3.SlackBuild        2019-09-22 08:54:14.603323876 -0700
@@ -132,6 +132,23 @@
 # Fix permissions on dynamic libraries.
 find $PKG -type f -perm 555 -exec chmod 755 '{}' \;
 
+# Multilib support
+mv $PKG/usr/include/python${BRANCH_VERSION}m/pyconfig.h \
+  $PKG/usr/include/python${BRANCH_VERSION}m/pyconfig-${LIBDIRSUFFIX:-32}.h ||
+  exit 1
+
+cat > $PKG/usr/include/python${BRANCH_VERSION}m/pyconfig.h << EOF
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "pyconfig-32.h"
+#elif __WORDSIZE == 64
+#include "pyconfig-64.h"
+#else
+#error "Unknown word size"
+#endif
+EOF
+
 # Install docs.
 mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
 cp -a README.rst LICENSE Misc $PKG/usr/doc/$PKGNAM-$VERSION


brokenshakles 09-22-2019 03:47 PM

O.O Thanks guys! I'm still working on trying to run Wayland/Enlightenment, running into other issues, but it's great to see that I have something to go on now, I will definitely apply the patch to the SlackBuild.

brokenshakles 09-22-2019 04:38 PM

Quote:

Originally Posted by Alien Bob (Post 6039273)
This needs to be fixed in the Slackware python3 package itself.
The pyconfig.h header file is not multilib-ready and it should be renamed based on whether you build a 32bit or a 64bit package. Then a wrapper pyconfig.h should be put in its place which includes the appropriate pyconfig header for the architecture.

I can not fix this in my multilib repository where I do nothing more but re-packaging the 32bit Slackware packages.


Does convertpkg-compat32 strip header files from the package? I think this may be an issue for python3-compat32, since with the above patch we are expecting a pyconfig-32.h file in the package, and I'm not seeing it after running the package thru convertpkg-compat32.

orbea 09-22-2019 05:13 PM

Quote:

Originally Posted by brokenshakles (Post 6039492)
Does convertpkg-compat32 strip header files from the package? I think this may be an issue for python3-compat32, since with the above patch we are expecting a pyconfig-32.h file in the package, and I'm not seeing it after running the package thru convertpkg-compat32.

I think the convertpkg-compat32 script needs an exception for cases like this, I haven't tested this, but I think it should change this section.

Code:

# Stuff we need to keep, we move into KDEP/ and move it back later:
mkdir KEEP
if [ "$PKGNAM" = "mesa" ];
then
  cp -a --parents usr/share/vulkan/icd.d KEEP/
fi

To something like this.

Code:

# Stuff we need to keep, we move into KDEP/ and move it back later:
mkdir KEEP
if [ "$PKGNAM" = "mesa" ];
then
  cp -a --parents usr/share/vulkan/icd.d KEEP/
elif [ "$PKGNAM" = "python3" ];
then
  cp -a --parents usr/include/python*m/pyconfig-*.h KEEP/
fi

Or you could always add the file directory to the package directory and run makepkg manually just to test it.


All times are GMT -5. The time now is 06:44 PM.