Opened 3 years ago

Closed 3 years ago

#24701 closed defect (duplicate)

Crash in linbox compiled with clang-3.8

Reported by: rws Owned by:
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

On OpenSuSE with clang-3.8 and CC=clang CXX=clang++

sage:  A = random_matrix(GF(127),200,200,density=0.01,sparse=True)
sage: A.rank()
---------------------------------------------------------------------------
SignalError                               Traceback (most recent call last)
<ipython-input-12-4b1a2344e717> in <module>()
----> 1 A.rank()

/home/ralf/sage/src/sage/matrix/matrix_modn_sparse.pyx in sage.matrix.matrix_modn_sparse.Matrix_modn_sparse.rank (build/cythonized/sage/matrix/matrix_modn_sparse.c:9389)()
    788         if is_prime(self.p):
    789             if gauss is False:
--> 790                 return self._rank_linbox(0)
    791             elif gauss is True:
    792                 return self._rank_linbox(1)

/home/ralf/sage/local/lib/python2.7/site-packages/sage/misc/decorators.pyc in wrapper(*args, **kwds)
    720                     kwds[new_name] = kwds[old_name]
    721                     del kwds[old_name]
--> 722             return func(*args, **kwds)
    723 
    724         return wrapper

/home/ralf/sage/src/sage/matrix/matrix_modn_sparse.pyx in sage.matrix.matrix_modn_sparse.Matrix_modn_sparse._rank_linbox (build/cythonized/sage/matrix/matrix_modn_sparse.c:9008)()
    728                 return x
    729             self._init_linbox()
--> 730             sig_on()
    731             # the returend pivots list is currently wrong
    732             #r, pivots = linbox.rank(1)

SignalError: Segmentation fault

#0  0x00007fffe58f1422 in std::ostream::sentry::sentry(std::ostream&) ()
   from /usr/lib64/libstdc++.so.6
#1  0x00007fffe58f1a38 in std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) () from /usr/lib64/libstdc++.so.6
#2  0x00007ffdbc8d7b06 in std::operator<< <std::char_traits<char> > (
    __out=..., __s=<optimized out>)
    at /usr/bin/../lib64/gcc/x86_64-suse-linux/4.8/../../../../include/c++/4.8/ostream:535
#3  LinBox::GaussDomain<Givaro::Modular<unsigned int, unsigned int> >::InPlaceLinearPivoting<LinBox::SparseMatrix<Givaro::Modular<unsigned int, unsigned int>, LinBox::SparseMatrixFormat::SparseSeq> > (this=<optimized out>, 
    Rank=<optimized out>, determinant=<optimized out>, LigneA=..., Ni=200, 
    Nj=200) at ../../linbox/algorithms/gauss/gauss.inl:505
#4  0x00007ffdbc8d6ab9 in linbox_modn_sparse_matrix_rank (
    modulus=<optimized out>, numrows=200, numcols=200, rows=<optimized out>, 
    gauss=0) at linbox-sage.C:119
#5  0x00007ffdbaab26ea in __pyx_f_4sage_4libs_6linbox_6linbox_18Linbox_modn_sparse_rank (__pyx_v_self=<optimized out>, __pyx_v_gauss=46130704)
    at build/cythonized/sage/libs/linbox/linbox.cpp:2826
#6  0x00007ffdbe89162f in __pyx_pf_4sage_6matrix_18matrix_modn_sparse_18Matrix_modn_sparse_28_rank_linbox (__pyx_v_self=0x7ffd9c6f69e0, __pyx_v_algorithm=)
    at build/cythonized/sage/matrix/matrix_modn_sparse.c:9018
#7  0x00007ffff7a44d01 in PyObject_Call 

Change History (11)

comment:1 Changed 3 years ago by fbissey

Hum, still clang using gcc's libstdc++ from gcc 4.8 in this case. Would sage want to build its own gcc on that box if there is just gcc-4.8?

comment:2 Changed 3 years ago by rws

I can't even replace that library but using a libc++ if the system has it would be nice.

comment:3 Changed 3 years ago by rws

  • Summary changed from Segfault in linbox when compiled with clang-3.8 to configure should make sure that on Linux libc++ is used with clang

comment:4 Changed 3 years ago by fbissey

That's a tall order as a check. Here it is also possible that the problem is the age of the gcc's libstdc++. Although I think it is better to use libc++/libcxx and that may be easier to enforce even it turns to be overbroad.

comment:5 follow-up: Changed 3 years ago by rws

Where we are now is that the right flags seem to be

export CC="clang"
export CXX="clang++ --stdlib=libc++"
export CXXFLAGS="$CXXFLAGS --stdlib=libc++"
export LDFLAGS="$LDFLAGS -lc++ --stdlib=libc++"

The stdlib directive is needed on all three variables because 1. without it in CXX several packages ignore CXXFLAGS and so it's not applied with clang++ (the compiler), 2. CXXFLAGS um well it belongs there, and 3. without it in LDFLAGS several packages link with libstdc++ (fpylll, sagelib).

Problem is #24705 and #24710.

Last edited 3 years ago by rws (previous) (diff)

comment:6 in reply to: ↑ 5 Changed 3 years ago by SimonKing

Replying to rws:

Where we are now is that the right flags seem to be

export CC="clang"
export CXX="clang++ --stdlib=libc++"
export CXXFLAGS="$CXXFLAGS --stdlib=libc++"
export LDFLAGS="$LDFLAGS -lc++ --stdlib=libc++"

Actually I also need to add -I/usr/include/libcxxabi/ for otherwise brial won't find a certain header (on my computer at least).

The stdlib directive is needed on all three variables because 1. without it in CXX several packages ignore CXXFLAGS and so it's not applied with clang++ (the compiler), 2. CXXFLAGS um well it belongs there, and 3. without it in LDFLAGS several packages link with libstdc++ (fpylll, sagelib).

Problem is #24705 and #24710.

comment:7 follow-up: Changed 3 years ago by rws

  • Milestone changed from sage-8.2 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

So this ticket is wontfix. Use these flags:

export CC="clang"
export CXX="clang++"
export CLANG_DEFAULT_CXX_STDLIB="libc++"

comment:8 Changed 3 years ago by rws

  • Status changed from needs_review to positive_review

comment:9 in reply to: ↑ 7 Changed 3 years ago by SimonKing

Replying to rws:

So this ticket is wontfix. Use these flags:

export CC="clang"
export CXX="clang++"
export CLANG_DEFAULT_CXX_STDLIB="libc++"

I understand that this ticket is not about letting sagelib build with clang (that's #24705). So, I'm not reverting the positive review for now.

comment:10 Changed 3 years ago by rws

  • Status changed from positive_review to needs_review
  • Summary changed from configure should make sure that on Linux libc++ is used with clang to Crash in linbox compiled with clang-3.8

#24716 looks similar. Duplicate?

comment:11 Changed 3 years ago by embray

  • Resolution set to duplicate
  • Status changed from needs_review to closed
Note: See TracTickets for help on using tickets.