failed to compile with intel c++ compiler 18.0
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
It looks like Intel c++ 18 fails to compile pybind11.
I tried to reproduce small example which compiles with Microsoft compiler and GCC but fails to compile with Intel 18 compiler:
#include <pybind11/pybind11.h>
#include <pybind11/embed.h>
#include <pybind11/common.h>
#include <pybind11/buffer_info.h>
#include <iostream>
#include <vector>
namespace py = pybind11;
using namespace py::literals;
class Matrix {
public:
Matrix(size_t rows, size_t cols) : m_rows(rows), m_cols(cols) {
m_data = new float[rows*cols];
}
~Matrix() {
delete[] m_data;
}
float *data() { return m_data; }
size_t rows() const { return m_rows; }
size_t cols() const { return m_cols; }
private:
size_t m_rows, m_cols;
float *m_data;
};
typedef std::vector<_inittab> inittab_vec_t;
void init_Matrix(py::module &m)
{
py::class_<Matrix>(m, "Matrix", py::buffer_protocol())
.def_buffer([](Matrix &m) -> py::buffer_info {
return py::buffer_info(
m.data(), /* Pointer to buffer */
sizeof(float), /* Size of one scalar */
py::format_descriptor<float>::format(), /* Python struct-style format descriptor */
2, /* Number of dimensions */
{ m.rows(), m.cols() }, /* Buffer dimensions */
{ sizeof(float) * m.cols(), /* Strides (in bytes) for each index */
sizeof(float) }
);
});
}
int main()
{
return 0;
}
Compiler options:
/Yu"stdafx.h" /GS /W3 /Gy /Zc:wchar_t /I"D:\ProgramData\Python34_64\include" /I"D:\ProgramData\code_dump\VisualStudioProjects\TestPybind11\\include" /Zi /O2 /Fd"x64\Release\vc140.pdb" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Qipo /Zc:forScope /Oi /MD /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Qstd=c++17 /Fp"x64\Release\Test1.pch"
Linker options:
/OUT:"D:\ProgramData\code_dump\VisualStudioProjects\TestPybind11\x64\Release\Test1.exe" /MANIFEST /NXCOMPAT /PDB:"D:\ProgramData\code_dump\VisualStudioProjects\TestPybind11\x64\Release\Test1.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /OPT:REF /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\Test1.exe.intermediate.manifest" /OPT:ICF /NOLOGO /LIBPATH:"D:\ProgramData\Python34_64\libs" /TLBID:1
Compiler gives strange errors.
For example it seems like compiler expects PYBIND11_DEPRECATED to be function in definition of method object_api:call
D:\ProgramData\code_dump\VisualStudioProjects\TestPybind11\\include\pybind11/pytypes.h(110): error : expected a type specifier
PYBIND11_DEPRECATED("call(...) was deprecated in favor of operator()(...)")
D:\ProgramData\code_dump\VisualStudioProjects\TestPybind11\\include\pybind11/pytypes.h(110): error #303: explicit type is missing ("int" assumed)
PYBIND11_DEPRECATED("call(...) was deprecated in favor of operator()(...)")
D:\ProgramData\code_dump\VisualStudioProjects\TestPybind11\\include\pybind11/pytypes.h(111): error : expected a ";"
object call(Args&&... args) const;
Or says that m_ptr is undefined in handle class
D:\ProgramData\code_dump\VisualStudioProjects\TestPybind11\\include\pybind11/pytypes.h(150): error : identifier "m_ptr" is undefined
PyObject *ptr() const { return m_ptr; }
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal C++ reproducer and the diagnostics at include/pybind11/pytypes.h lines 110 and 150, using Intel C++ 18 with the reported options. Compare the failing declarations with compilation under the working Microsoft and GCC compilers; done means the reproducer compiles successfully with Intel C++ 18.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100