Opened 2 years ago

Closed 2 years ago

#29856 closed enhancement (fixed)

Sort out linking with libstdc++

Reported by: dimpase Owned by:
Priority: major Milestone: sage-9.2
Component: build Keywords:
Cc: arojas, mkoeppe, fbissey, isuruf Merged in:
Authors: Dima Pasechnik Reviewers: Matthias Koeppe
Report Upstream: N/A Work issues:
Branch: afeec95 (Commits, GitHub, GitLab) Commit: afeec9594418b97df7b948416001a522387f4244
Dependencies: #29702 Stopgaps:

Status badges

Description (last modified by slelievre)

From the post at

it appears linking with libstdc++ might be not needed any more, and so this may be simplified.

Note that clang project has libc++, which serves the same role, but is a different implementation.

(Currently stdc++ is mentioned in src/setup.py and in src/sage/misc/cython.py.)

Change History (19)

comment:1 Changed 2 years ago by dimpase

trying to see what happens with the simple

  • src/sage/misc/cython.py

    index af5f99d03e..0600603e62 100644
    a b cblas_library_dirs = list(cblas_pc['library_dirs']) 
    4141cblas_include_dirs = list(cblas_pc['include_dirs'])
    4242
    4343standard_libs = [
    44     'mpfr', 'gmp', 'gmpxx', 'stdc++', 'pari', 'm',
     44    'mpfr', 'gmp', 'gmpxx', 'pari', 'm',
    4545    'ec', 'gsl',
    4646] + cblas_libs + [
    4747    'ntl']
  • src/setup.py

    a b class sage_build_cython(Command): 
    354354
    355355        - Add dependencies on header files for certain libraries
    356356
    357         - Ensure that C++ extensions link with -lstdc++
    358 
    359357        - Sort the libraries according to the library order
    360358
    361359        - Add some default compile/link args and directories
    class sage_build_cython(Command): 
    369367        lang = kwds.get('language', 'c')
    370368        cplusplus = (lang == "c++")
    371369
    372         # Libraries: add stdc++ if needed and sort them
    373370        libs = kwds.get('libraries', [])
    374         if cplusplus:
    375             libs = libs + ['stdc++']
    376371        kwds['libraries'] = sorted(set(libs),
    377372                key=lambda lib: library_order.get(lib, 0))
    378373

comment:2 Changed 2 years ago by dimpase

  • Description modified (diff)

comment:3 Changed 2 years ago by mkoeppe

This ticket description needs some work; what problem is this ticket addressing?

Also, setup.py does not use sage.misc.cython at all if I'm not mistaken.

And please note #29702 moves the code from src/setup.py to sage_setup - best to do changes on top of that

comment:4 Changed 2 years ago by dimpase

  • Description modified (diff)

comment:5 Changed 2 years ago by mkoeppe

  • Description modified (diff)

comment:6 Changed 2 years ago by dimpase

  • Authors set to Dima Pasechnik
  • Branch set to u/dimpase/build/get_rid_of_stdcxx
  • Commit set to 07010d430f28325d4d45ee9cfe8cad7b89be9064
  • Dependencies set to #29702
  • Status changed from new to needs_review
  • Summary changed from sort out linking with libstd++ to sort out linking with libstdc++

seems to work.


Last 10 new commits:

5790687build/bin/write-dockerfile.sh: Do not ADD removed file src/Makefile.in
851ab76Make sagelib a script package
f39a017Move src/fpickle_setup.py to srs/sage_setup/
363f792src/setup.py: Move class sage_install to new module sage_setup.command.sage_install
a7cde9csrc/module_list.py: Move library_order to new module sage_setup.library_order
7c4bbf6src/setup.py: Move classes sage_build_* to new modules sage_setup.command.sage_*
ddc49aasrc/setup.py: Move excepthook to new module sage_setup.excepthook
9cff0c6src/sage_setup/command/__init__.py: New
56705f8src/sage_setup/command/sage_build_cython.py: Fix adding setup.py as dependency
07010d4remove stdc++ from everywhere

comment:7 Changed 2 years ago by mkoeppe

tested on GH Actions?

comment:8 Changed 2 years ago by mkoeppe

Please rebase on unrebased-then-merged #29702

comment:9 Changed 2 years ago by dimpase

  • Branch changed from u/dimpase/build/get_rid_of_stdcxx to u/dimpase/dont_link_to_stdcxx
  • Commit changed from 07010d430f28325d4d45ee9cfe8cad7b89be9064 to afeec9594418b97df7b948416001a522387f4244

Last 10 new commits:

e810ad1Trac #29345: don't use sage's config.status for the lrcalc build.
93c9921Trac #29345: replace the function that populates the CVXOPT_* variables.
0e66a0aTrac #29345: add Dima's SPKG patches for ksh compatibility.
df3f05ebuild/make/Makefile.in [SCRIPT_PACKAGE_templ]: cd into the SPKG directory; adjust spkg-install scripts
5372065Merge branch 't/29793/script_packages_should_cd_into_the_spkg_directory' into t/29411/make_sagelib_a_script_package
c166b97Merge branch 't/29411/make_sagelib_a_script_package' into t/29702/move_all_code_from_src_setup_py__src_fpickle_setup_py_to_sage_setup
cc30471build/bin/write-dockerfile.sh: Do not ADD removed file src/Makefile.in
8a41326Merge branch 't/29411/make_sagelib_a_script_package' into t/29702/move_all_code_from_src_setup_py__src_fpickle_setup_py_to_sage_setup
a56dc35Merge tag '9.2.beta1' into t/29702/public/move_all_code_from_src_setup_py__src_fpickle_setup_py_to_sage_setup
afeec95explictly linking with libstdc++ not needed

comment:10 follow-up: Changed 2 years ago by dimpase

testing on https://github.com/dimpase/sage/pull/10 (also, this will test #29702)

comment:11 Changed 2 years ago by mkoeppe

Great

comment:12 in reply to: ↑ 10 Changed 2 years ago by dimpase

Replying to dimpase:

testing on https://github.com/dimpase/sage/pull/10 (also, this will test #29702)

I see a lot of assembler errors (GNU 'as' version 2.24, ~6 years old) in building ecm, and elsewhere, on minimal ubuntu-trusty

2020-06-16T00:41:24.9539407Z   [ecm-7.0.4.p1]   /tmp/ccEhz4KE.s:342: Error: operand size mismatch for `vmovdqu64'

see https://github.com/dimpase/sage/runs/774196885

Not a surprise, as we build a newish gcc, not really compatible with an old as, running on hardware not 100% supported by this as. Should we just drop this target all together?

Last edited 2 years ago by dimpase (previous) (diff)

comment:13 Changed 2 years ago by dimpase

On ubunty-bionic standard I see

2020-06-16T01:19:21.1467385Z   [dochtml]   ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /sage/local/lib/python3.7/site-packages/sage/matrix/matrix_integer_sparse.cpython-37m-x86_64-linux-gnu.so)

which looks like a broken toolchain (`GLIBCXX_3.4.26' not found) - any idea why?

see https://github.com/dimpase/sage/runs/774196977

The rest looks OK to me.

Last edited 2 years ago by dimpase (previous) (diff)

comment:14 follow-up: Changed 2 years ago by mkoeppe

The above two, are these from -gcc_spkg builds? Please add links to the runs

comment:15 Changed 2 years ago by mkoeppe

(See #29675 for known failures of -gcc_spkg builds with "GLIBCXX not found" errors.)

comment:16 in reply to: ↑ 14 Changed 2 years ago by dimpase

Replying to mkoeppe:

The above two, are these from -gcc_spkg builds? Please add links to the runs

done

comment:17 Changed 2 years ago by mkoeppe

  • Reviewers set to Matthias Koeppe
  • Status changed from needs_review to positive_review

comment:18 Changed 2 years ago by slelievre

  • Description modified (diff)
  • Summary changed from sort out linking with libstdc++ to Sort out linking with libstdc++

comment:19 Changed 2 years ago by vbraun

  • Branch changed from u/dimpase/dont_link_to_stdcxx to afeec9594418b97df7b948416001a522387f4244
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.