mono / CppSharp

Tools and libraries to glue C/C++ APIs to high-level languages
MIT License
3.09k stars 506 forks source link

Stackoverflow parsing Eigen #1397

Open jlaxson opened 4 years ago

jlaxson commented 4 years ago
Brief Description

When parsing a header that #includes <Eigen/Dense> or similar, the parse hanges for a long time before failing with a Stack overflow. I certainly don't need all (or any) of the Eigen functionality mapped but since it is failing in the parse stage, seems like applying TypeMap won't help.

OS: OS X Built from master with downloaded llvm

Used headers
#include <Eigen/Dense>

struct MyStruct {
  Eigen::Vector3f eigen_member_;
};
Used settings

mono bin/CppSharp.CLI.exe testheader.h -I /usr/local/include/eigen --debug Target: Clang

Stack trace or incompilable generated code
Generating C# bindings for OSX x86...
Parsing libraries...
Parsing code... (ed: very long time here)
Stack overflow: IP: 0x107eb9f3f, fault addr: 0x7ffeed50bfc8
Stacktrace:
  at <unknown> <0xffffffff>
  at CppSharp.Parser.ClangParser.ParseHeader (CppSharp.Parser.CppParserOptions) [0x0001e] in <bcd3c6bf8cbb4e14b1b403fccc6db1b9>:0
  <...>
  at CppSharp.ClangParser.ParseSourceFiles (System.Collections.Generic.IEnumerable`1<string>,CppSharp.Parser.ParserOptions) [0x00044] in <10575253dd0841909563e0a4ef285e3e>:0
  at CppSharp.Driver.ParseCode () [0x0006d] in <7687010274814f718efb10ca9e0b80ac>:0
  at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary) [0x00090] in <7687010274814f718efb10ca9e0b80ac>:0
  at CppSharp.Generator.Run () [0x0014e] in <06190b4a6e594f2aaca23a3affd0edb3>:0
  at CppSharp.CLI.Main (string[]) [0x00043] in <06190b4a6e594f2aaca23a3affd0edb3>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x0002a] in <06190b4a6e594f2aaca23a3affd0edb3>:0
ddobrev commented 4 years ago

@jlaxson we know about this bug, in fact, it's been reported with the very same header. Out free time is limited at present but you can always try contacting our support.

brunnerant commented 2 years ago

Are there any updates on that issue ? I am facing the same problem and I don't really see any workaround for now : |

tritao commented 2 years ago

@brunnerant Wish I had a better answer to tell you but the fact is our time to work on these kind of fixes is extremely limited, given all the other issues and improvements we could be doing.

The fastest way to get this over the line is to get in contact with either me or @josetr and sponsor the fix, we offer pretty fair rates for this kind of support work and will gladly help you with what you need.