Fixes a false warning thrown when compiling with --enable-tsan#12781
Fixes a false warning thrown when compiling with --enable-tsan#12781Johan511 wants to merge 2 commits intoocaml:trunkfrom
Conversation
|
Thank you for spotting this and closing in on the cause. For information, another way to print the commands executed by make is to run The problem is that when the compiler is configured with |
|
Removing (LDOPTS) doesn't seems to cause any errors on my local machine (linux) where (LDTOPS) expands to
as you have mentioned @OlivierNicole But in runner which seems to run only on an windows environment, couple of tests fail. The popular error seems to be
In the runner, (LDOPTS) expands to
|
|
Removing LDOPTS is almost certainly the wrong thing to do here. But there may be deeper issues:
I think we should try to improve ocamlmkliib rather than torture our makefiles even more. One possibility would be to silently pass any unrecognized option to |
|
Olivier Nicole (2023/11/24 07:31 -0800):
The problem is that when the compiler is configured with
`--enable-tsan`, `LDOPTS` is set to the contents of contains `-lm
-lpthread -fsanitize=thread`. We need to keep only the first two.
With a very quick look, two lines look suspiscious to me in
`configure.ac`:
Line 1764:
native_ldflags="$native_ldflags -fsanitize=thread $libunwind_ldflags"
I am skeptical that it's correct to add `-fsanitize=thread` to an
ldflags variable.
Line 2455:
[cclibs="$cclibs -fsanitize=thread"])
Likewise.
|
I think that only executables needs to be linked with
Is there a dedicated variable for options that need to be passed when linking executables, but not libraries? |
|
Olivier Nicole (2023/12/01 09:15 -0800):
Is there a dedicated variable for options that need to be passed when
linking executables, but not libraries?
Are you sure this needs to be passed only when linkink? I would expect
an option starting with -f to have to be passed all the way down?
|
|
Yes, it also needs to be passed when compiling. |
7742406 to
7961855
Compare
7961855 to
a2581d6
Compare
…n and hence not passing it to gcc when building a dll
a2581d6 to
4f397f4
Compare
|
In a private discussion with @Johan511 we agreed that the simplest option would be for ocamlmklib to ignore the flag |
…and creating a shared library does not need the option
|
I can confirm this works to remove the spurious warning, but I will refrain from approving as I am biased as an internship mentor. |
|
Then maybe @shindere would be available to review this? |
|
Re-reading the whloe discussion quickly, I don't understand why we
don't add the `-fsanitize=thread` flag to a variable of the CFLAGS
family where it seems it would fit perfectly?
|
|
After discussing this in private with @shindere, we agreed that |
|
Sorry this is not correct. A more accurate summary is:
|
|
Closing this PR, since the problem it attempted to fix has been addressed in #13201. |
|
Although this problem has found a more principled solution, thanks @Johan511 for the initial fix proposal! |
|
Olivier Nicole (2024/06/04 07:05 -0700):
Although this problem has found a more principled solution, thanks
@Johan511 for the initial fix proposal!
Indeed! And for having noticed the issue!
|
When compiling otherlibs/unix the following warning is thrown
The following rule is used to compile
libunixbyte.alib$(CLIBNAME_BYTECODE).$(A): $(COBJS) $(V_OCAMLMKLIB)$(MKLIB) -oc $(CLIBNAME_NATIVE) $(COBJS_NATIVE) $(LDOPTS)LDOPTS does not seem to be mandatory when linking objects .a libraries.