modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
452 stars 165 forks source link

Fix feature check macros for POSIX realpath #4302

Open beutlich opened 5 months ago

beutlich commented 5 months ago

Resolves #4301.

This is PR for master that hopefully can get back-ported to main/4.1.0 after merge.

TeoGoddet commented 4 months ago

@beutlich on my system and with the lib creating the problem (open62541), switching to defined(_BSD_SOURCE) did not fix the problem. The problem was then that realpath was not availlable, which may be not normal and due to another error in another lib

beutlich commented 4 months ago

@TeoGoddet Can you please find out why realpath is not available when you expected it to be available?

TeoGoddet commented 4 months ago

@beutlich I don't think that realpath should be available (dymola windows with visual studio 22 compiler)

I will try to understand if Open62541 is doing wrong or not with the BSD_SOURCE

https://github.com/open62541/open62541/blob/3f381ea37a8e2c0e352a0e05f49859627f753ac1/tools/ua-tool/ua.c#L18

beutlich commented 4 months ago

@TeoGoddet OK, waiting for your feedback then.

beutlich commented 4 months ago

@TeoGoddet I also do not understand why would you want to build ua.c (executable) together with ModelicaInternal.c. 😕

TeoGoddet commented 4 months ago

@beutlich sorry I gave the wrong file, the problematic one is : https://github.com/open62541/open62541/blob/88dbcb6d644aaf3c38d2a1af9fc9cc2755c24c42/arch/win32/ua_architecture.h#L133 They may be wrong defining _BSD_SOURCE without defining all the expected function, what do you think ?

beutlich commented 4 months ago

what do you think ?

That header file is 5 years old and not part of current open62541 code. Still being confused.

TeoGoddet commented 4 months ago

@beutlich It end up in the single file version of the lib for some reason (found here https://github.com/open62541/open62541/releases/tag/v1.3.6) I tested removing it and it seems that the lib still work I create an issue on their side about this

On this side I think that this PR is needed to ensure proper handling of -D_BSD_SOURCE that is quite common

beutlich commented 4 months ago

@TeoGoddet Could you please share a minimal Modelica model and workflow (in a separate repo) that demonstrates your observations? Thanks!