msolve icon indicating copy to clipboard operation
msolve copied to clipboard

Cpp include support

Open epitavy opened this issue 9 months ago • 10 comments

This pull request aims at making smoother the process of integrating msolve as a library into another code. I am currently integrating it in a C++ codebase, so I added some #ifdef __cplusplus extern "C" directives.

epitavy avatar Mar 25 '25 09:03 epitavy

Hi @epitavy,

Many thanks! Unfortunately, it seems that make check fails on MacOS at the moment. I am not sure what is wrong though.

jerebertho avatar Mar 25 '25 10:03 jerebertho

Hi @jerebertho I am investigating the issue. I guess it comes from the AC_USE_SYSTEM_EXTENSIONS directive in configure.ac that doesn't work as expected under macos.

epitavy avatar Mar 25 '25 10:03 epitavy

Actually its probably because of the CI runner. Brew uses the lastest version of flint which is flint 3.2.1. I think the tests failures comes from this.

epitavy avatar Mar 25 '25 10:03 epitavy

Do you get the same issue with make check on your own machine? if yes, could you please share test-suite.log? thank you.

I am trying to see any hint from the CI regarding the fact that it may be related to the recent FLINT version, but I cannot find such a hint; we have recently made sure msolve should compile with FLINT v3.2.1, but there might be something we have missed.

vneiger avatar Mar 25 '25 11:03 vneiger

@vneiger The only thing that I see is that indeed, it downloads Flint-3.2.1 while for all the previous PRs such as #199, it used Flint-3.1.3-p1.

jerebertho avatar Mar 25 '25 11:03 jerebertho

@vneiger The only thing that I see is that indeed, it downloads Flint-3.2.1 while for all the previous PRs such as #199, it used Flint-3.1.3-p1.

Ok, so I have just re-run CI for #199, it used Flint-3.2.1 this time, and there the tests pass.

vneiger avatar Mar 25 '25 12:03 vneiger

Indeed, I rebuilt msolve with flint 3.2.1 and cannot reproduce the failed test on Debian/Linux. I will investigate more

epitavy avatar Mar 25 '25 12:03 epitavy

I reproduce the problem on macos. The problem on macos comes that 2 "free" are added in the file src/msolve/iofiles.c.

line_endings_support(73976,0x7ff8469ab680) malloc: *** error for object 0x7f7dc2700000: pointer being realloc'd was not allocated
line_endings_support(73976,0x7ff8469ab680) malloc: *** set a breakpoint in malloc_error_break to debug

When these 2 "free" are removed, all tests passed.

gastineau avatar Mar 25 '25 20:03 gastineau

I just removed the free so that the tests pass on macos

epitavy avatar Mar 26 '25 09:03 epitavy

it would be good to have a real C++ test. (probably not on this PR...)

dimpase avatar Mar 28 '25 16:03 dimpase

@dimpase To have a real C++ test would require a C++ compiler to build the tests !

epitavy avatar May 12 '25 15:05 epitavy

Can someone merge this PR so that it is available in the next release ?

epitavy avatar May 12 '25 15:05 epitavy

@dimpase To have a real C++ test would require a C++ compiler to build the tests !

To build C++ tests, yes, not all the tests. But this is not a problem, it's pretty easy with autoconf to test/configure for a C++ compiler.

dimpase avatar May 13 '25 00:05 dimpase