Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1380101

Summary: linbox not available on aarch64
Product: [Fedora] Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: linboxAssignee: Jerry James <loganjerry>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: loganjerry, paulo.cesar.pereira.de.andrade, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: aarch64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-09 21:01:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 922257, 1380191    

Description Dominik 'Rathann' Mierzejewski 2016-09-28 16:26:58 UTC
Description of problem:
linbox package is not available in aarch64 repositories, causing builds to fail.

Version-Release number of selected component (if applicable):
1.4.2-2.fc26

How reproducible:
Always.

Steps to Reproduce:
1. Try building sagemath from master branch HEAD (fedpkg build --scratch --nowait --arch=aarch64)

Actual results:
No matching package to install: 'linbox-devel'

Expected results:
No uninstallable dependencies.

Additional information:
https://kojipkgs.fedoraproject.org//work/tasks/9610/15809610/root.log
https://koji.fedoraproject.org/koji/buildinfo?buildID=804574

Comment 1 Zbigniew Jędrzejewski-Szmek 2016-09-29 06:52:34 UTC
I tried building linbox, but it fails when compiling tests:

In file included from /usr/include/fflas-ffpack/fflas/fflas_freduce.inl:38:0,
                 from /usr/include/fflas-ffpack/fflas/fflas_freduce.h:56,
                 from /usr/include/fflas-ffpack/fflas/fflas.h:104,
                 from /usr/include/fflas-ffpack/ffpack/ffpack.h:46,
                 from ../linbox/matrix/matrixdomain/blas-matrix-domain.h:45,
                 from ../linbox/matrix/matrix-domain.h:68,
                 from ../linbox/matrix/sparsematrix/sparse-generic.h:80,
                 from ../linbox/matrix/sparse-matrix.h:70,
                 from test-solve.C:45:
/usr/include/fflas-ffpack/utils/bit_manipulation.h: In function 'uint64_t divide_128(uint64_t, uint64_t, uint64_t, uint64_t*)':
/usr/include/fflas-ffpack/utils/bit_manipulation.h:114:10: error: impossible constraint in 'asm'
         );
          ^
This seems to be an error in fflas-ffpack, it seems to assume that amd64 register names are available.

http://koji.fedoraproject.org/koji/taskinfo?taskID=15855078

Comment 2 Dominik 'Rathann' Mierzejewski 2016-09-29 12:14:31 UTC
It built on armv7hl before and the tests passed. Maybe it just doesn't know about aarch64 and assumes x86?

Comment 3 Dominik 'Rathann' Mierzejewski 2016-09-29 12:16:37 UTC
Also, it looks like it's being built with -O2 in CFLAGS:

g++ -DHAVE_CONFIG_H -I. -I..  -DLinBoxTestOnly  -Wall -g -DNDEBUG -U_LB_DEBUG -g -DNDEBUG -U_LB_DEBUG -I../linbox -Wall -DNDEBUG -UFFLASFFPACK_DEBUG -D__FFLASFFPACK_HAVE_CBLAS  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fno-strict-aliasing -fopenmp  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -I/usr/include/atlas      -I/usr/include/m4rie -I/usr/include/saclib  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -c -o test-rational-solver.o test-rational-solver.C
In file included from /usr/include/bits/libc-header-start.h:33:0,
                 from /usr/include/stdint.h:26,
                 from /usr/lib/gcc/aarch64-redhat-linux/6.2.1/include/stdint.h:9,
                 from /usr/include/givaro/givconfig.h:86,
                 from /usr/include/fflas-ffpack/fflas-ffpack-config.h:119,
                 from ../linbox/linbox-config.h:30,
                 from test-rational-solver.C:31:
/usr/include/features.h:360:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^~~~~~~

Comment 4 Dominik 'Rathann' Mierzejewski 2016-09-29 12:16:57 UTC
... I mean *without* -O2.

Comment 5 Dominik 'Rathann' Mierzejewski 2016-09-29 12:29:25 UTC
... but that's on purpose:

# Don't try to optimize the tests; the build takes gargantuan amounts of memory
sed -i 's|-O2||g' tests/Makefile

It's rather a bug in fflas-ffpack:
fflas_ffpack-2.2.2/fflas-ffpack/utils/bit_manipulation.h:
#ifdef __FFLASFFPACK_HAVE_INT128
// division 128bits by 64 bits
// int128_t(u1,u0) = u1*2^64+u0, div v, rem r
// return quo
static uint64_t divide_128(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r)
{
        // u0 -> rax
        // u1 -> rdx
        // divq
        uint64_t result;
        __asm__("divq %[v]"
                        : "=a"(result), "=d"(*r)
                        : [v] "r"(v), "a"(u0), "d"(u1)
               );
        return result;
}
#endif

The use of x86 assembly should be guarded by appropriate #ifdefs or intrinsics should be used.

Comment 6 Dominik 'Rathann' Mierzejewski 2016-09-29 12:32:01 UTC
It looks like the Debian maintainer reported a related bug already: https://github.com/linbox-team/fflas-ffpack/issues/45

Comment 7 Dominik 'Rathann' Mierzejewski 2016-09-29 13:02:21 UTC
However, enabling -O optimization for the tests makes the build complete and tests pass on aarch64:

http://koji.fedoraproject.org/koji/taskinfo?taskID=15859942

Comment 8 Dominik 'Rathann' Mierzejewski 2016-09-29 15:50:03 UTC
No issues on other primary arches either, so committed, pushed and new build submitted: http://koji.fedoraproject.org/koji/taskinfo?taskID=15861362 .