Merge makefiles in otherlibs/systhreads#785
Conversation
otherlibs/systhreads/Makefile
Outdated
| ifeq "$(UNIX_OR_WIN32)" "unix" | ||
| $(MKLIB) -o $(LIBNAME) -ocamlc '$(CAMLC)' -cclib -lunix $(PTHREAD_CAML_LINK) $^ | ||
| else # Windows | ||
| $(MKLIB) -o $(LIBNAME) -ocamlc "$(CAMLC)" -linkall $^ |
There was a problem hiding this comment.
Why is linkall used under Windows and not Unix?
There was a problem hiding this comment.
Alain Frisch (2016/08/30 00:28 -0700):
-threads.cma: $(THREAD_OBJS)
$(MKLIB) -ocamlc '$ (CAMLC)' -o threads $(THREAD_OBJS) \ +$(LIBNAME).cma: $(THREADS_BCOBJS)-cclib -lunix $(PTHREAD_CAML_LINK)
+ifeq "$(UNIX_OR_WIN32)" "unix"$(MKLIB) -o $ (LIBNAME) -ocamlc '$(CAMLC)' -cclib -lunix$(PTHREAD_CAML_LINK) $ ^
+else # Windows$(MKLIB) -o $ (LIBNAME) -ocamlc "$(CAMLC)" -linkall $^Why is linkall used under Windows and not Unix?
To be honest, I don't know. It's just the way things were done before so
I tried to be as conservative as possible for this commit, in order to
separate changes from each other. But if you think it would be better to
add linkall under Linux as well I'm perfectly fine and can certainly do
so, so please just let me know.
Thanks a lot for the review!
There was a problem hiding this comment.
Merging makefiles has the nice benefit of making such differences apparent, and one should then really either remove or document them. But indeed, this can come later.
There was a problem hiding this comment.
Alain Frisch (2016/08/30 01:08 -0700):
-threads.cma: $(THREAD_OBJS)
$(MKLIB) -ocamlc '$ (CAMLC)' -o threads $(THREAD_OBJS) \ +$(LIBNAME).cma: $(THREADS_BCOBJS)-cclib -lunix $(PTHREAD_CAML_LINK)
+ifeq "$(UNIX_OR_WIN32)" "unix"$(MKLIB) -o $ (LIBNAME) -ocamlc '$(CAMLC)' -cclib -lunix$(PTHREAD_CAML_LINK) $ ^
+else # Windows$(MKLIB) -o $ (LIBNAME) -ocamlc "$(CAMLC)" -linkall $^Merging makefiles has the nice benefit of making such differences
apparent, and one should then really either remove or document them.
But indeed, this can come later.
I agree. For this specific example, it's just that it' was not obvious
to me what to do.
There are other places where I got rid of the differences, e.g. IIRC not
all the files were installed properly on Windows, I think it was the
.mli files which were not installed.
In the same vein, the warning-related flags were also different and I
took the most strict ones.
38ed141 to
6c6dabe
Compare
|
Generally speaking, I'd suggest to add TODO comments to make it explicit when you discover "unexplained" differences between the two versions during the merge. Otherwise, people would easily assume that an explicit conditional in a Makefile is on purpose and not consider investigating the reason for the difference later. |
|
That's a good idea and I will do that, thanks a lot.
|
6c6dabe to
4fe3c52
Compare
otherlibs/systhreads/Makefile
Outdated
|
|
||
| libthreads.a: $(BYTECODE_C_OBJS) | ||
| $(MKLIB) -o threads $(BYTECODE_C_OBJS) $(PTHREAD_LINK) | ||
| allopt: lib$(LIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).cmxs $(CMIFILES) |
There was a problem hiding this comment.
This should be lib$(LIBNAME)nat.$(A), no?
There was a problem hiding this comment.
Alain Frisch (2016/08/30 14:43 -0700):
-libthreads.a: $(BYTECODE_C_OBJS)
$(MKLIB) -o threads $ (BYTECODE_C_OBJS) $(PTHREAD_LINK)
+allopt: lib$(LIBNAME).$(A)$(LIBNAME).cmxa $ (LIBNAME).cmxs $(CMIFILES)This should be
lib$(LIBNAME)nat.$(A), no?
Well I'm getting confused. I believe that, at this level, the proposed
changes faithfully reflect the behaviour of the former Makefile.nt. Or
am I missing something here? Sorry if that's the case...
There was a problem hiding this comment.
Yes, but it was probably wrong (and Makefile was right).
|
Several simplifications could be added if we decide to drop the compilation of threads.cmxs and dllthreads.dll (both used to be built under Windows only). I'm in favor of doing it. |
ae57e93 to
2d8ba8b
Compare
|
Alain Frisch (2016/08/30 14:55 -0700):
Done. Alain Frisch (2016/08/30 14:56 -0700):
So we discussed with @damiendoligez. He also thinks building the shared Alain Frisch (2016/08/30 15:07 -0700):
It has indeed been removed. Alain Frisch (2016/08/30 15:13 -0700):
Done. If you see other simplifications your comments are welcome. (making make -j work in this directory seems to be a different matter Alain Frisch (2016/08/31 03:15 -0700):
Fixed. Alain Frisch (2016/08/31 03:20 -0700):
@dra27 you may want to review this PR. A few additional remarks:
In case you do not remember, we (@damiendoligez and I) propose to use I also removed two things:
|
No, unfortunately, I don't remember (that branch was the one were the notion of .cmxs plugins was added). |
|
Alain Frisch (2016/09/05 08:21 -0700):
Okay. So I can add the -linkall on the Unix side as suggested earlier. This, however, leads to two other questions:
Can anyone see a way to unify these two commands?
|
2d8ba8b to
93b8624
Compare
|
The PR has been rebased on latest trunk and updated so that -linkall is
used consistently.
Moreover, comments have been added about those points that need further
clarification.
Can anybody see anything that still needs to be done before merging?
Thanks.
|
|
The CI build fails with: (-linkall should not be added between -o and its argument) |
otherlibs/systhreads/Makefile
Outdated
| $(CAMLOPT) -a -o threads.cmxa $(THREAD_OBJS:.cmo=.cmx) \ | ||
| -cclib -lthreadsnat $(PTHREAD_CAML_LINK) | ||
| $(LIBNAME).cmxa: $(THREADS_NCOBJS) | ||
| $(CAMLOPT) -a -o -linkall $@ $^ -cclib -lthreadsnat $(PTHREAD_CAML_LINK) |
There was a problem hiding this comment.
This line causes the build failure.
There was a problem hiding this comment.
|
Thanks again for your hard work Sébastien! I suggest that we group all these related changes into a single entry in the Changes file, if you agree. |
|
Alain Frisch (2016/09/13 08:59 -0700):
Thanks for merging @alainfrisch, and thanks even more for your patience Hope things will be easier with #808. |
|
Alain Frisch (2016/09/13 09:00 -0700):
Well, sorry for the lack of rigor!
Certainly! |
|
I'm getting some linking errors with 4.05 as dllthreads.so is no longer installed. This seems to be caused by this PR. Is it intentional? |
|
Note that ocamlrun is linked with -lpthread, so dynamic loading of threads.cma doesn't cause dynamic linking of -lpthread |
|
It looks like an accident - "both" platforms. |
|
It should be |
|
We really should alter the testsuite and CI so that the testsuite is run over an installed OCaml, not just a compiled one! |
|
Agreed for the testsuite. I think the fix can be committed directly. Should |
|
Yes to everything! |
|
Ok, fixed in 812eb68 |
|
Jérémie Dimino (2017/01/27 09:50 -0800):
Ok, fixed in 812eb68
Many thanks Jérémie and David for your work on this! Sorry for the
error!!
Agreed that the testsuit should work against an installed version of
OCaml. Took note of this and will take it into account!
|
|
Being able to run the testsuite from the compiled checkout without installation is important to me. The reason is that I have to configure a source checkout carefully to be able to install it as an opam switch, and I don't always remember to do this when I just run a build to test something. Forcing me to install would either force me to reconfigure (and rebuild) or risk overwriting the currently-configured switch location. Having both test-from-sources and test-from-install targets would of course be fine. |
|
Gabriel Scherer (2017/01/28 03:00 -0800):
Having both test-from-sources and test-from-install targets would of
course be fine.
That's what I'd like to achieve.
test-from-install seems especially important in the context of
cross-compiling.
|
|
David Allsopp (2017/01/28 03:13 -0800):
@shindere - thanks, I'll have a look. Get well soon - hope that arm's
mending!
Thanks. I'm a bit worried because it seems to evolve very slowly, if at
all. Rather frustrating! :)
|
|
@shindere no poblem, get well soon. I'm glad we can now build all of JS packages against trunk on a daily basis. This should help as well with testing trunk |
|
@dra27, I disagree, I think it suggests that |
|
:) After my recent battles with AppVeyor in #1024, I couldn't agree more with that! As soon as you want spaces in filenames and directories, the same becomes true for make! |
* Make sure the PTHREAD_CAML_LINK variable is defined everywhere. * Merge makefiles in otherlibs/systhreads Before this commit, the .cma and .cmxa libraries were linked using -linkall under Windows but not under Unix. It was not possible to clarify why -linkall was useful, but given the small size of the involved modules and the fact that, for most modules, it does not seem to make much sense to use one without the others, it has been decided to use -linkall everywhere. This commit also stops building the .cmxs shared library under Windows, for consistency reasons (it was built only under Windows before).
Unexport some unprefixed global names
Basic Cfg instructions don't raise. Only terminators can raise. Includes extension of the validator for register allocation with structural checks.
… for better alignment (ocaml#785) Co-authored-by: Sabine Schmaltz <[email protected]>
The initial project was to submit one PR merging all the makefiles in
all subdirectories of otherlibs. However it turned out that just the merge
in the systhreads directory is rather non trivial and may deserve a separate
review.
@alainfrisch you may want to review it since it seems you have worked on it.