manylinux: Cannot build C++14 in docker images
Hello. I’m in the situation where I have a C++14 extension (using the brilliant (pybind11)[https://github.com/pybind/pybind11] library), but the GCC version installed on the docker images are 4.8 and do not support the C++14 standard.
Is there a way I can get around this, and would still be able to produce manylinux1 wheels?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 60 (34 by maintainers)
For anyone landing on this issue, I had the same issue but with C++17 features required to build the pysimdjson wheels. I’ve uploaded a derived manylinux image with gcc8.3 pre-built and is available here -> https://hub.docker.com/r/tktechdocker/manylinux.
If you want to build your own, here’s a usable dockerfile:
If you want to change the version of GCC built into the image just set
$GCC_VERSIONwhen building. Fun fact, a macbook pro building gcc will cause first-degree burns.@YannickJadoul it is, but you can just change:
FROM quay.io/pypa/manylinux1_x86_64toFROM quay.io/pypa/manylinux1_x86… to use the 32bit base.I’m using this image to produce binaries for a tool that uses processor features only available on x86_64 so 32bit wasn’t of interest to me.
If you use the Steam hardware survey as a (biased) baseline, about 1.3% of Windows users are 32bit, and ~0% of Linux users. https://store.steampowered.com/hwsurvey/.
32-bit Linux is getting pretty fringe these days, I bet you can get away without. That’s not so for 32-bit Windows, there’s still a reasonable percentage of Windows Python installs that are 32-bit. I estimated it at 35% or a year or so ago: https://github.com/statsmodels/statsmodels/issues/4657#issuecomment-390726164
I’m attempting to automate it with Github Actions so in the future new images should become available any time manylinux or gcc have a release.
Updating the query now, for the last 30 days of Numpy downloads from PyPI, 32-bit Windows wheels were at 45% for Python 3.7, 50% for Python 2.7, and 27% (oddly) for Python 3.6. So, yes, still a big appetite for 32-bit on Windows.
I’ve rebuilt @TkTech’s excellent docker image for GCC 9.1.0, you can find it at dockerhub or just pull
tstenner/manylinux:gcc9.1.0.Anaconda’s download page puts 64-bit first and the (unlabeled) “Download” button downloads 64-bit: https://www.anaconda.com/distribution/#download-section This would suggest doing so can’t be causing that many problems for a reasonably diverse category of Python users with modern computers.
@YannickJadoul I symlinked
cctogccin my 7.2 build.I also just set the
LD_LIBRARY_PATHin my builds. You’re welcome to make a pull request to the build script if you want to make that unnecessary, though I probably won’t rebuild the binaries until there’s a new version of at least one of the components.@Noctem Amazing, it’s working, thanks! 😃 There’s just two things I need to fix in order to get it working: setting the variables
LD_LIBRARY_PATH(because it couldn’t findlibisl.so.15) andCC(because otherwise CMake looks forccin the path and considers that as the system-wide compiler). So just as some feedback/suggestion, if you’d be interested: I know the latter is fixed by @squeaky-pl by just adding a symlinkcctogccwhen packaging. And the former would maybe be solved by setting therpath? But I don’t know enough about those details. (But things perfectly build without all that, and I need to setCXXFLAGS="-static-libstdc++"anyway, so these are just minor details 😉 )Side note. I pushed GCC 7.1 release: https://github.com/squeaky-pl/centos-devtools/releases/tag/7.1
I think it would be great if we could add some of the information in this thread as instructions for getting modern C++ working in the manylinux1 container to the wiki or readme or something. I think many people would benefit from them.
Sent from my iPhone
@YannickJadoul what about feeding
-static-libstdc++to the compiler/linker?