Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 674112 - dev-python/m2crypto-0.31.0 on armhf - src_compile(): swig: /usr/include/gnu/stubs.h:7: Error: Unable to find 'gnu/stubs-soft.h'
Summary: dev-python/m2crypto-0.31.0 on armhf - src_compile(): swig: /usr/include/gnu/s...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-30 18:16 UTC by matoro
Modified: 2019-08-14 19:37 UTC (History)
10 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (info.txt,5.08 KB, text/plain)
2018-12-30 18:16 UTC, matoro
Details
build.log (build.log,8.51 KB, text/plain)
2018-12-30 18:18 UTC, matoro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matoro archtester 2018-12-30 18:16:59 UTC
Created attachment 559030 [details]
emerge --info

On armhf, the swig section of dev-python/m2crypto fails with the following error:

running build_ext
building 'M2Crypto._m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -D__armv6l__ -I/usr/include/python2.7 -I/usr/include -I/usr/include/openssl -I/usr/lib/gcc/armv6j-unknown-linux-gnueabihf/8.2.0/include -I/usr/lib/gcc/armv6j-unknown-linux-gnueabihf/8.2.0/include-fixed -I/usr/include -includeall -modern -builtin -outdir /var/tmp/portage/dev-python/m2crypto-0.31.0/work/M2Crypto-0.31.0/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
/usr/include/gnu/stubs.h:7: Error: Unable to find 'gnu/stubs-soft.h'
error: command 'swig' failed with exit status 1

It appears to be related to confusion over hard/softfloat ABIs.  The contents of /usr/include/gnu/stubs.h are:

#if !defined __ARM_PCS_VFP
# include <gnu/stubs-soft.h>
#endif
#if defined __ARM_PCS_VFP
# include <gnu/stubs-hard.h>
#endif

such that stubs-hard.h should be included on armhf systems, and stubs-soft.h otherwise.  I have verified that __ARM_PCS_VFP is appropriately defined:

#include <stdio.h>
#include <gnu/stubs.h>
int main() {
  printf("%i\n", __ARM_PCS_VFP);
  return 0;
}

$ gcc -Wall -Wextra -Werror -pedantic test.c -o test
$ ./test
1

So this does seem to be swig's fault somehow.
Comment 1 matoro archtester 2018-12-30 18:18:10 UTC
Created attachment 559032 [details]
build.log
Comment 2 m.manico 2019-01-16 06:08:12 UTC
See also:

https://bugs.gentoo.org/667110
cross-armv7a-hardfloat-linux-gnueabi/gcc-8.2.0-r3 fails due to stubs-soft.h missing
Comment 3 m.manico 2019-02-03 07:50:29 UTC
I ran tc-is-softfloat from
/usr/portage/eclass/toolchain-funcs.eclass

with the following output:

# tc-is-softfloat
no

I was also able to reproduce the test results from the original report https://bugs.gentoo.org/674112#c0


I noticed the "-D__armv7l__" the swig command of the error. Maybe this needs to be updated?
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2019-02-04 22:28:12 UTC
bug #667110 is probably unrelated. I guess swig (or m2crypto?) disables all predefined macros and breaks /usr/include/gnu/stubs.h import.
Comment 5 m.manico 2019-03-17 06:55:45 UTC
This bug started to influence other packages (iirc openssl related) negatively. They would not update because they depend on m2crypto.

I modified /usr/include/gnu/stubs.h as follows:

== /usr/include/gnu/stubs.h ============
#if !defined __ARM_PCS_VFP
//# include <gnu/stubs-soft.h>
# include <gnu/stubs-hard.h>
#endif
#if defined __ARM_PCS_VFP
# include <gnu/stubs-hard.h>
#endif
========================================

and ran

== root# ===============================
emerge -avt dev-python/m2crypto
========================================

which will emerge dev-python/m2crypto successfully.

After that, I undid my changes to /usr/include/gnu/stubs.h and updated successfully as usual.
Comment 6 Steve Arnold archtester gentoo-dev 2019-08-14 18:42:09 UTC
This does need some kind of fix/workaround for updating arm32 systems (although I'm not quite sure exactly where it needs to be fixed; most likely swig).  Making a symlink from stubs-hard.h to stubs-soft.h is a viable workaround at least on hardfp, but would break softfp if anyone needs that.  Ideas?
Comment 7 Mike Gilbert gentoo-dev 2019-08-14 19:14:29 UTC
(In reply to Steve Arnold from comment #6)

We could add some code to the ebuild to set the proper defines in SWIG_FEATURES based on tc-arch and tc-is-softfloat. I would just need someone to help me identify when -D__ARM_PCS_VFP should be added.

We already do something similar when building for the x32 ABI on amd64.
Comment 8 Mike Gilbert gentoo-dev 2019-08-14 19:18:11 UTC
Or better yet, we could just call tc-cpp-is-true "defined(__ARM_PCS_VFP)" directly.
Comment 9 Larry the Git Cow gentoo-dev 2019-08-14 19:37:02 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2a02b28d0a6e69cecefae8c2f93adef20ccbfe3

commit d2a02b28d0a6e69cecefae8c2f93adef20ccbfe3
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-08-14 19:36:01 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2019-08-14 19:36:56 +0000

    dev-python/m2crypto: fix build on armhf
    
    Closes: https://bugs.gentoo.org/674112
    Package-Manager: Portage-2.3.71_p6, Repoman-2.3.17_p5
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-python/m2crypto/m2crypto-0.31.0-r2.ebuild | 22 +++++++++++++++++-----
 dev-python/m2crypto/m2crypto-0.35.2.ebuild    | 22 +++++++++++++++++-----
 2 files changed, 34 insertions(+), 10 deletions(-)