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

BUG: numpy build fails with gcc version 4.9.2 #21302

Closed
jzombi opened this issue Apr 6, 2022 · 5 comments · Fixed by #21306
Closed

BUG: numpy build fails with gcc version 4.9.2 #21302

jzombi opened this issue Apr 6, 2022 · 5 comments · Fixed by #21306
Labels
00 - Bug C++ Related to introduction and use of C++ in the NumPy code base component: build

Comments

@jzombi
Copy link

jzombi commented Apr 6, 2022

Describe the issue:

Numpy fails to build with gcc version 4.9.2 with the following error:

RuntimeError: Broken toolchain: cannot link a simple C++ program. note: A compiler with support for C++11 language features is required.

This should not be a problem, because C++11 standard is supported since gcc 4.8.1.

The problem is that when compiling the test code in numpy/core/setup.py, the -std=c++11 flag is not passed to the compiler.
The default c++ standard was changed in version 6.1 from C++98 to C++14, so this issue might affect all prior gcc versions.

By monkey-patching setup.py to include the -std=c++11 flag, the build run successfully.

Reproduce the code example:

python setup.py build

Error message:

RuntimeError: Broken toolchain: cannot link a simple C++ program. note: A compiler with support for C++11 language features is required.

NumPy/Python version information:

1.22.3 3.8.12 (default, Jan 12 2022, 09:59:17)
[GCC 4.9.2]

@jzombi jzombi added the 00 - Bug label Apr 6, 2022
@seberg seberg added the C++ Related to introduction and use of C++ in the NumPy code base label Apr 6, 2022
@seberg
Copy link
Member

seberg commented Apr 6, 2022

@serge-sans-paille should we be adding this flag (on old gccs?)

@mattip
Copy link
Member

mattip commented Apr 7, 2022

See also #20344 which tried to enable -std=c++11 only where required. We had a gcc 4.8 run in CI but dropped it in #19665, with a comment about maybe restoring it if we get pushback. It seems there is at least one user still compiling with an older gcc, maybe we should reconsider the CI run.

@serge-sans-paille
Copy link
Contributor

The problem is that when compiling the test code in numpy/core/setup.py, the -std=c++11 flag is not passed to the compiler.

This is strange, because we're passing -std=c++11 to extra_cxx_compile_args= in both numpy/linalg/setup.py and numpy/core/setup.py

serge-sans-paille added a commit to serge-sans-paille/numpy that referenced this issue Apr 7, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
@serge-sans-paille
Copy link
Contributor

#21306 should fix the issue

serge-sans-paille added a commit to serge-sans-paille/numpy that referenced this issue Apr 7, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
serge-sans-paille added a commit to serge-sans-paille/numpy that referenced this issue Apr 7, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
@jzombi
Copy link
Author

jzombi commented Apr 7, 2022

@serge-sans-paille it works, thanks!
(I leave this issue open, because it seems that when your commit is merged in main, it will be automatically closed.)

serge-sans-paille added a commit to serge-sans-paille/numpy that referenced this issue Apr 7, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
serge-sans-paille added a commit to serge-sans-paille/numpy that referenced this issue Apr 8, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
melissawm pushed a commit to melissawm/numpy that referenced this issue Apr 12, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
charris pushed a commit to charris/numpy that referenced this issue May 5, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
charris pushed a commit to charris/numpy that referenced this issue May 5, 2022
Group all C++ flags in one location.

This avoids redundancy and makes sure we test the flags we use, and use the
flags we test.

Fix numpy#21302
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug C++ Related to introduction and use of C++ in the NumPy code base component: build
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants