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

MacOS X support #325

Closed
jesperpedersen opened this issue Aug 25, 2022 · 8 comments
Closed

MacOS X support #325

jesperpedersen opened this issue Aug 25, 2022 · 8 comments
Labels
community Issue that can be picked up by the community enhancement Improvement to an existing feature

Comments

@jesperpedersen
Copy link
Collaborator

Identified as

System is Darwin
@jesperpedersen jesperpedersen added enhancement Improvement to an existing feature community Issue that can be picked up by the community labels Aug 25, 2022
@2010YOUY01
Copy link
Contributor

I'm trying to make it run on OSX, it can build so far, but there are several issues:

  1. ld linker on OSX doesn't seem to have '-z' option, it will throw errors ld: unknown option: -z clang: error: linker command failed with exit code 1 (use -v to see invocation), so those lines to set the option are disabled https://github.com/agroal/pgagroal/blob/master/src/CMakeLists.txt#L142 I'm not sure if it will cause any problem.
  2. How can I perform something like an integration test to make sure everything works?

@jesperpedersen
Copy link
Collaborator Author

  1. Hmm, checks like https://github.com/agroal/pgagroal/blob/master/src/CMakeLists.txt#L202 should catch this, and disable the linker flag. Any idea of why it fails ?

  2. Unfortunately, it is a manual setup - you can follow the tutorials in order to get a basic setup - https://github.com/agroal/pgagroal/tree/master/doc/tutorial

Thanks for working on this !

@2010YOUY01
Copy link
Contributor

  1. Hmm, checks like https://github.com/agroal/pgagroal/blob/master/src/CMakeLists.txt#L202 should catch this, and disable the linker flag. Any idea of why it fails ?
  2. Unfortunately, it is a manual setup - you can follow the tutorials in order to get a basic setup - https://github.com/agroal/pgagroal/tree/master/doc/tutorial

Thanks for working on this !

Cool! I will setup and test it later.

For 1. according to the compiler manual

/usr/bin/clang --help | grep "-Wl"
-Wl, Pass the comma separated arguments in to the linker
/usr/bin/clang --help | grep "-z "
-z Pass -z to the linker

-Wl and -z options in the compiler seem only forward it to the linker, and it didn't care if the linker supports that. (same for gcc)
The doc for linker on Linux said it support -z option, and OSX doesn't.

So both on Linux and OSX, https://github.com/agroal/pgagroal/blob/master/src/CMakeLists.txt#L202 HAS_RELRO is set.
I tried changing it to check_linker_flag("-z relro" HAS_RELRO). On Linux it's set, on OSX it's not set, which is the expected behavior.
If that's the case, this issue can be fixed first.

@jesperpedersen
Copy link
Collaborator Author

Sounds good - feel free to send pull requests once you have them; remember to add yourself to the AUTHORS file.

Thanks !

@jesperpedersen
Copy link
Collaborator Author

Maybe the initial patch should be a dedicated Darwin branch based on the Linux one...

@2010YOUY01
Copy link
Contributor

So all the changes for Darwin support should be done in a new branch, could you help create a Darwin branch then I can send PRs to that branch?

@jesperpedersen
Copy link
Collaborator Author

I meant a CMakeFiles.txt branch -- aka elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")

@jesperpedersen
Copy link
Collaborator Author

This is done - thanks @2010YOUY01 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issue that can be picked up by the community enhancement Improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants