-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Druntime test merge fix #4883
Druntime test merge fix #4883
Conversation
@@ -1,5 +1,5 @@ | |||
# set explicitly in the make cmdline in druntime/Makefile (`test/%/.run` rule): | |||
ifneq (,$(findstring ldmd2,$(DMD))) | |||
ifdef IN_LDC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mm, much better, I like! 👍
It might be worth reconsidering splitting the D flags into compile- and link-flags - there's no harm in including link-flags in compiles too, just a bit longer/more explicit command lines in the make output (normally hidden). |
I would rather not change this design because I purposefully made it follow the way other build systems do it, and if they do it this way I assume that there is a reason for it. So, until I fully understand this reason I would rather go with the possibly sub-optimal design. |
d2ca7c6
to
e60ead6
Compare
I've marked which commits should be upstreamed. The failure which I gathered are:
The
Shouldn't the library path on windows by the |
Yes! The old makefile changed the suffix from ldc/runtime/druntime/test/shared/Makefile Line 82 in 61c11b7
But I changed that as I assumed the DRUNTIMESO would be the dll: ldc/runtime/druntime/test/shared/Makefile Line 149 in e60ead6
which it is within dmd but not within ldc. |
Ah okay, that is fine then. |
IIRC, upstream changed that not too long ago. I went with DRUNTIMESO as import .lib because that's needed much more often than the DLL (so no need for variable
|
And with
|
I've looked a little bit more:
Now:
A new test started failing:
|
@@ -179,12 +147,14 @@ $(ROOT)/linkD$(DOTEXE): private extra_ldlibs += $(abs_root)/lib$(for_linking) | |||
$(ROOT)/linkDR.done: $(ROOT)/lib$(DOTDLL) | |||
$(ROOT)/linkDR$(DOTEXE): $(DRUNTIME_DEP) utils.h | |||
$(ROOT)/linkDR$(DOTEXE): private extra_ldlibs += $(ldl) $(druntime_for_linking) | |||
ifneq ($(OS),windows) | |||
$(ROOT)/linkDR$(DOTEXE): private extra_ldflags += -Wl,-rpath,$(dir $(druntime_for_linking)) | |||
endif | |||
|
|||
$(ROOT)/loadDR.done: $(ROOT)/lib$(DOTDLL) $(DRUNTIMESO) | |||
$(ROOT)/loadDR.done: private run_args = $(DRUNTIMESO) | |||
$(ROOT)/loadDR$(DOTEXE): utils.h | |||
$(ROOT)/loadDR$(DOTEXE): private extra_ldlibs += $(ldl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess Alpine/musl somehow needs the rpath too (as for linkDR
, and what we previously enforced in CMake, CFLAGS_BASE
) - the assertion/abort comes from being unable to load a dependency of either druntime or the lib.so
.
Edit: I've already used ifeq (1,$(shell which apk &>/dev/null && echo 1))
as rough Alpine detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've already added a check like this to upstream's exceptions
test but I think it will be easier if we keep the musl detection in cmake (since we already have a snippet for that) and just pass IS_MUSL=1
to the makefiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay setting the rpath worked. - Are you going to upstream that IS_MUSL
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so this failed for ldc because it uses -soname
when building the shared druntime when upstream doesn't. I already split other -rpath
fixes in a commit for upstream so I think it's appropriate to do the same here. I should probably move the IS_MUSL
conditional up in common.mak
and change it to something that detects musl not just Alpine since the tests fail in my Musl chroot as well
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
The $(OBJDIR) variable already contains the ./ leading prefix and, when it is set to an absolute path (like ldc does), prepending ./ is an error. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
The druntime testsuite requires a more recent version of make then what is shipped by default with macos. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
As per msvc docs, when a directory is specified to /Fo it should end with a slash. cl.exe seems to handle the argument anyway but clang-cl.exe fails with it, which is used by ldc. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
When linking executables through CC also pass -rpath to the directory that contains the druntime library, in case the shared variant would be linked. This is currently only a problem for ldc because the posix linkers encode the full path to the druntime library in DT_NEEDED (which avoids requiring -rpath during runtime) only if said library has no soname. ldc's druntime is built with soname but dmd's isn't which hid the issue. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
This just discarded the -mMODEL flag on windows which is obviously undesired. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
The -rpath argument is correctly handled by the tests which need it. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
…ldflags Since it's a flag that affects compilation for correctness it should be passed in dflags rather than ldflags.d. There were no issues visible because the compilation and linking are done in one step in most of the tests. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Pass the .dll instead of the .lib when invoking the testsuite. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
The test fails on musl without the flag: ``` /usr/bin/cc -g -Wall src/loadDR.c -ldl -o /root/build/runtime/druntime-test-shared-debug/loadDR Testing loadDR /root/build/runtime/druntime-test-shared-debug/loadDR /root/build/lib/libdruntime-ldc-debug-shared.so.111.0 Aborting from rt/sections_elf_shared.d(966) Failed to get library handle.gmake: *** [../common.mak:192: /root/build/runtime/druntime-test-shared-debug/loadDR.done] Aborted (core dumped) ``` Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Thanks buddy! |
There are still a few more tests failing which I accidentally overlooked but they should only be a few, I will go through them again |
Fix the druntime tests merge conflicts as well as resolve some issues with the test code. Some changes are specific to LDC and should remain here, some are bugs that should be fixed upstream but currently they're all in separate commits and will be split and squashed later.