Skip to content
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

Fix Makefile.rules on OpenBSD #428

Merged
merged 1 commit into from
Aug 24, 2016
Merged

Fix Makefile.rules on OpenBSD #428

merged 1 commit into from
Aug 24, 2016

Conversation

abbysmal
Copy link
Contributor

Hello,

When compiling on OpenBSD I encountered this error

ocamlfind ocamlmklib -o _build/ctypes-foreign-base_stubs _build/src/ctypes-foreign-base/dl_stubs.o _build/src/ctypes-foreign-base/ffi_call_stubs.o _build/src/ctypes-foreign-base/ffi_type_stubs.o -L/usr/local/lib -pthread -lffi
ocamlfind: unknown option '-pthread'.

That seems related to a line in Makefile.rules.
I fixed that a few weeks ago but can't remember much about the fix itself, I'm not sure I understand what's going on.
I tested it and it looks like it works on Linux and OpenBSD at least.
Do you have any idea on what might be the issue ?

patch attached to fix the problem.

@yallop
Copy link
Owner

yallop commented Aug 17, 2016

I don't think that the proposed fix is quite what's needed -- at least, I don't see a useful interpretation of % here.

Perhaps the issue is that the linker flags are being passed directly to ocamlmklib, but should instead be prefixed with -cclib. Does the following work for you on OpenBSD?

OCAMLMKLIB_FLAGS=$($(PROJECT).link_flags:%=-cclib %)

@abbysmal
Copy link
Contributor Author

Seems like it works! Thank you.
May I close the PR and let you add the change to the repo ? Or should I change my PR to reflect to change ?

@yallop
Copy link
Owner

yallop commented Aug 24, 2016

Thanks for testing.

If you push the change to this branch I'll merge it in.

@xguerin
Copy link

xguerin commented Oct 3, 2016

Just a quick up to also mention that I have the same problem on OpenBSD. To bad for the revert. Any idea how to approach it ? I can look into it if necessary.

@yallop
Copy link
Owner

yallop commented Oct 3, 2016

I'm not sure what the best approach is, and don't have an OpenBSD machine available to investigate, but a patch would be very welcome.

@xguerin
Copy link

xguerin commented Oct 3, 2016

Alright, so here is the deal:

  • it looks like ocamlfind ocamlmklib calls on ld directly
  • on OpenBSD, pkg-config is used to get the link flags, which include -pthread
  • when used verbatim with ld, these options fail as -pthread is not a valid flag for OpenBSD ld

I am not quite sure what to think of it yet. I asked the Internet for similar issues, but rare are the occasions where ld is used directly with pkg-config.

Also, given that I am uncertain of the scope of pkg-config, I am not certain on whom to call fool yet. Indeed, the pkg-config --libs line would work perfectly fine with gcc or clang.

I'll shoot an e-mail on the OpenBSD mailing list and see if they have a a heuristic for that situation.

@yallop
Copy link
Owner

yallop commented Oct 3, 2016

@xguerin: Thanks for the details. Could you check whether #454 solves the issue for you on OpenBSD?

@xguerin
Copy link

xguerin commented Oct 3, 2016

@yallop Yes, I can attest that that #454 fixes the compilation problem with OpenBSD.

@yallop
Copy link
Owner

yallop commented Oct 3, 2016

Excellent; thanks, @xguerin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants