Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexeicolin/4f3f1a11e740e0c01cce to your computer and use it in GitHub Desktop.
Save alexeicolin/4f3f1a11e740e0c01cce to your computer and use it in GitHub Desktop.
Patch PyMix AUR package: fix 'undefined symbol cblas_*' error: record libgslcblase as dependency
From 798db16996767608bfa3c082a300e3756cb46eac Mon Sep 17 00:00:00 2001
From: Alexei Colin <ac@alexeicolin.com>
Date: Thu, 18 Feb 2016 00:24:15 -0500
Subject: [PATCH] remove --as-needed to record libgslcblas dep
---
PKGBUILD | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/PKGBUILD b/PKGBUILD
index 1676ef3..b267f74 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -20,6 +20,27 @@ prepare() {
}
build() {
+ # Issue: libgsl depends on libgslcblas, but the NEEDED flag is not set for
+ # this dependency (libgslcblas.so doesn't show up in ldd libgsl.so). This
+ # might or might not be intentional, but in any case '--as-needed' is not
+ # being passed during libgsl build, so that's not the problem.
+ #
+ # PyMix does list libgslcblas as a dependency explicitly. But, it the
+ # NEEDED flag for this dependency does not get set in the extension shared
+ # library, because --as-needed is passed to the linker. The following
+ # manipulation of env variables removes --as-needed from the linker line.
+ # To make matters worse, this flag gets included twice.
+ #
+ # Python's distutils ends up using two sets of LDFLAGS: (1) LDFLAGS from
+ # 'build time' (see _init_posix in distutils/sysconfig.py), (2) LDFLAGS
+ # from makepkg.conf. There's no way to override the build time flags. But,
+ # luckily distutils first checks LDSHARED var, and uses it instead of the
+ # build time LDFLAGS, so we set LDSHARED (note that it must contain the
+ # linker's name, not just flags). We edit out --as-needed from LDFLAGS,
+ # which seems nicer than clearing LDFLAGS completely.
+ export LDFLAGS=$(echo $LDFLAGS | sed 's/,--as-needed//g')
+ export LDSHARED="gcc -shared"
+
cd "$srcdir/$_pkgname-$pkgver"
python2 setup.py build
}
--
2.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment