Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in linbox compiled with clang-3.8 #24701

Closed
rwst opened this issue Feb 10, 2018 · 8 comments
Closed

Crash in linbox compiled with clang-3.8 #24701

rwst opened this issue Feb 10, 2018 · 8 comments

Comments

@rwst
Copy link

rwst commented Feb 10, 2018

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 

Component: packages: standard

Issue created by migration from https://trac.sagemath.org/ticket/24701

@rwst rwst added this to the sage-8.2 milestone Feb 10, 2018
@kiwifb
Copy link
Member

kiwifb commented Feb 10, 2018

comment:1

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?

@rwst
Copy link
Author

rwst commented Feb 10, 2018

comment:2

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

@rwst rwst changed the title Segfault in linbox when compiled with clang-3.8 configure should make sure that on Linux libc++ is used with clang Feb 11, 2018
@kiwifb
Copy link
Member

kiwifb commented Feb 11, 2018

comment:4

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.

@rwst
Copy link
Author

rwst commented Feb 11, 2018

comment:5

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.

@simon-king-jena
Copy link
Member

comment:6

Replying to @rwst:

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.

@rwst
Copy link
Author

rwst commented Feb 12, 2018

comment:7

So this ticket is wontfix. Use these flags:

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

@rwst rwst removed this from the sage-8.2 milestone Feb 12, 2018
@simon-king-jena
Copy link
Member

comment:9

Replying to @rwst:

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.

@rwst
Copy link
Author

rwst commented Feb 13, 2018

comment:10

#24716 looks similar. Duplicate?

@rwst rwst changed the title configure should make sure that on Linux libc++ is used with clang Crash in linbox compiled with clang-3.8 Feb 13, 2018
@embray embray closed this as completed Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants