tbeu / matio

MATLAB MAT File I/O Library
https://matio.sourceforge.io
BSD 2-Clause "Simplified" License
330 stars 97 forks source link

Fix linker options #212

Closed tbeu closed 11 months ago

tbeu commented 11 months ago

Closes https://github.com/tbeu/matio/issues/209

@seanm Please confirm if it works for you when using CMake ≥ 3.17. Thanks.

seanm commented 11 months ago

This works thanks!

MaartenBent commented 11 months ago

The HAVE_LINK_EXPORTED_SYMBOLS_LIST test always seems to fail, so now those flags are never added on macOS. I haven't been able to make it pass. I suggest removing the test and changing the check to elseif(APPLE AND HAVE_LINK_UNDEFINED_ERROR).

tbeu commented 11 months ago

I suggest removing the test and changing the check to elseif(APPLE AND HAVE_LINK_UNDEFINED_ERROR).

Done by https://github.com/tbeu/matio/pull/212/commits/400cfec4059d30bd918fb895bed9187e088a9b00.

seanm commented 11 months ago

Although I'm using macOS, my impression is this issue is related to AFL more than it is to macOS. I would expect the same problem with AFL on linux too...

MaartenBent commented 11 months ago

Although I'm using macOS, my impression is this issue is related to AFL more than it is to macOS. I would expect the same problem with AFL on linux too...

Does the updated patch still work for you? Because now it will use --retain-symbols-file, while with the first version of the patch it wouldn't use any linker flag.

seanm commented 11 months ago

Does the updated patch still work for you?

It does.

tbeu commented 11 months ago

Does the updated patch still work for you?

It does.

With invalidated CMake cache, I hope.

MaartenBent commented 11 months ago

Thanks for testing.

Maybe --retain-symbols-file works on Linux too when using clang and/or ldd. But I couldn't get it to work on Windows. Thats why I suggested to limit it to APPLE for now. Since these options were originally added only for macOS because it didn't work with --no-undefined.

This should be unaffected by the CMake cache. The result variables of check_linker_flag are cached, but if/else is evaluated every time you rerun CMake. Though testing with a clean build directory is always good.