Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#24710 closed defect (invalid)

scipy build failure with changed LDFLAGS

Reported by: rws Owned by:
Priority: blocker Milestone: sage-duplicate/invalid/wontfix
Component: build Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: u/rws/don_t_send_all_ldflags_to_gfortran (Commits, GitHub, GitLab) Commit: a7e5e0bc861432e60c8764307f475485811ddb17
Dependencies: Stopgaps:

Status badges

Description (last modified by rws)

Using the environment variables:

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

scipy fails to build with

    /usr/bin/gfortran -Wall -g -shared -L/home/ralf/sage/local/lib -Wl,-rpath,/h
ome/ralf/sage/local/lib -L/home/ralf/sage/local/lib/python/lib -L/home/ralf/sage
/local/lib -lc++ --stdlib=libc++ -L/home/ralf/sage/local/lib/python/lib -L/home/
ralf/sage/local/lib build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy
/fftpack/_fftpackmodule.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o b
uild/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7
/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.
o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o
 build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o 
build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/build/src.linux-x86_64-2.
7/scipy/fftpack/fortranobject.o -L/home/ralf/sage/local/lib -Lbuild/temp.linux-x
86_64-2.7 -ldfftpack -lfftpack -lpython2.7 -lgfortran -o build/lib.linux-x86_64-
2.7/scipy/fftpack/_fftpack.so
    gfortran: error: unrecognized command line option '--stdlib=libc++'

Complete log is attached.

The reason is that the libc++ directive is meant for linking commands using clang++. It should be filtered out when using gfortran as linker.

Attachments (1)

scipy-0.19.1.log (1.1 MB) - added by rws 3 years ago.

Download all attachments as: .zip

Change History (17)

Changed 3 years ago by rws

comment:1 Changed 3 years ago by rws

  • Description modified (diff)
  • Summary changed from scipy build fails with gfortran complaining about CXXFLAGS to Don't send all LDFLAGS to gfortran

comment:2 Changed 3 years ago by rws

  • Branch set to u/rws/don_t_send_all_ldflags_to_gfortran

comment:3 Changed 3 years ago by rws

  • Commit set to a7e5e0bc861432e60c8764307f475485811ddb17
  • Status changed from new to needs_review

With this patch scipy installs whenever --stdlib=libc++ is used in LDFLAGS.


New commits:

a7e5e0b24710: filter out directive meant for clang++ linker

comment:4 Changed 3 years ago by rws

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

So this ticket is wontfix. Use these flags:

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

comment:5 Changed 3 years ago by jdemeyer

  • Resolution set to invalid
  • Status changed from positive_review to closed

comment:6 follow-up: Changed 3 years ago by SimonKing

Perhaps closing the ticket was premature. See the comments around comment 25 in #24716: It seems that LDFLAGS is needed after all, which means that the fix from here is needed.

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

comment:7 in reply to: ↑ 6 Changed 3 years ago by jdemeyer

Replying to SimonKing:

It seems that LDFLAGS is needed after all

From a quick look at #24716, it seems that the bug is in NTL upstream. Globally setting LDFLAGS to something involving C++ libraries seems wrong because LDFLAGS is not specific to C++.

Anyway, if you want to reopen this ticket, I would like a good explanation why you need to change LDFLAGS globally.

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

Indeed libc++ does not seem necessary after all, #24701 may be a problem of the clang version or of the libstdc++ version. My mistake was after the initial #24701 I changed two things at once (clang version and stdlib) and assumed the wrong of the two produced success.

comment:9 Changed 3 years ago by rws

This however still begs the question how it would be possible to change the standard C++ library when building Sage, if needed.

comment:10 in reply to: ↑ 8 Changed 3 years ago by SimonKing

Replying to rws:

Indeed libc++ does not seem necessary after all, #24701 may be a problem of the clang version or of the libstdc++ version. My mistake was after the initial #24701 I changed two things at once (clang version and stdlib) and assumed the wrong of the two produced success.

Without doing something about stdlib, Sage simply doesn't build for me with clang. That has of course been the first thing that I tried.

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

But you didn't change your clang version, right? So how do you know your problem was only because of your missing libc++ flag? At that time I suggested so but I was wrong. ptestlong with clang-4/libstdc++ is fine here, as I just saw.

comment:12 in reply to: ↑ 11 ; follow-up: Changed 3 years ago by SimonKing

Replying to rws:

But you didn't change your clang version, right? So how do you know your problem was only because of your missing libc++ flag? At that time I suggested so but I was wrong. ptestlong with clang-4/libstdc++ is fine here, as I just saw.

How to install clang-4 on ubuntu? apt-get install clang gives version 3.8.

comment:13 in reply to: ↑ 12 Changed 3 years ago by SimonKing

Replying to SimonKing:

How to install clang-4 on ubuntu? apt-get install clang gives version 3.8.

I see: apt-get install clang-4.0.

comment:14 Changed 3 years ago by SimonKing

I can confirm that on ubuntu with clang-4.0 Sage builds fine and passes all tests. However, I still see that some stuff that I care about is 14% slower with clang than with gcc. So, again, it is good for portability but not for production.

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

  • Summary changed from Don't send all LDFLAGS to gfortran to scipy build failure with changed LDFLAGS

Thanks for testing it all on Ubuntu. So I think we can close this and recommend clang-4 with the flags CC=clang CXX=clang++.

comment:16 in reply to: ↑ 15 Changed 3 years ago by SimonKing

Replying to rws:

Thanks for testing it all on Ubuntu. So I think we can close this

... or rather "keep it closed".

and recommend clang-4 with the flags CC=clang CXX=clang++.

Yes and no. Currently on ubuntu, "clang" is "clang version 3.8".

Note: See TracTickets for help on using tickets.