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

Add homebrew tap #394

Open
plajjan opened this issue Aug 11, 2022 · 9 comments
Open

Add homebrew tap #394

plajjan opened this issue Aug 11, 2022 · 9 comments
Labels
is:question Issue is actually a question.

Comments

@plajjan
Copy link

plajjan commented Aug 11, 2022

Please implement a Homebrew tap for installing libnetconf!

I would like to get libnetconf2 on my Mac and would prefer if I could do that in a convenient manner through Homebrew, which is my package manager of choice.

The use case is to use it for development of a netconf module for the standard library in Acton, a programming language we are developing which in turn is developed both on Linux and Mac!

I'm opening it here but I suppose I really want libyang too, since that's a dependency.

@michalvasko michalvasko added the is:question Issue is actually a question. label Aug 18, 2022
@michalvasko
Copy link
Member

Have you actually tried it? libyang should be fully supported on Mac but libnetconf2 is not. Specifically, there were serious problems with both SSH and TLS support so the only working setup probably is the raw NETCONF communication and SSH/TLS encryption handled by an external tool.

@plajjan
Copy link
Author

plajjan commented Aug 18, 2022

No, I have not tried compiling libnetconf2 on mac... Started doing my development on Linux but I'm hoping to run it on mac as well, once my code is written. Tried to get ahead by ensuring that libnetconf2 is available on mac so I can easily test once I'm happy with my code :)

Do you have some extra info on the difficulties with libnetconf2 on mac? I mean libssh (which I really care about) is in homebrew for mac, as is openssl.. is there something in particular that poses a problem?

@plajjan
Copy link
Author

plajjan commented Aug 18, 2022

Seems I've been able to build libnetconf2 on mac... I mean, it compiled, though I dunno if it works ;) I think it was just a single tweak, beyond setting some paths... but that tweak does indicate to me that I might be the first person attempting this. Though realizing as I type this that I did this on the master branch whereas perhaps devel is ahead...

Anyway, is there an interest at all from your side in maintaining homebrew formulas for libyang and libnetconf2? I might be able to help write the initial formulas, but would you guys be willing to host and maintain that stuff?

@michalvasko
Copy link
Member

michalvasko commented Aug 19, 2022

How exactly did you manage that? You had to disable SSH support, did you not? SSH uses local system users to check authenticated users, which is using the Linux API and that obviously refused to be compiled on Mac.

As for TLS, the last time I tested it (years ago), I have encountered critical issues but do not remember them exactly. What I do remember is the cause, which is that OpenSSL on Mac was actually not OpenSSL but some Apple-maintained library with similar API "pretending" to be OpenSSL but behaving differently in some cases. After learning this I completely gave up having any Mac support for libnetconf2 and am not keen on getting into all this again when you have to expect the weirdest kinds of problems. Unfortunately, the same goes for the homebrew formulas. Creating them should not be a problem but maintenance is another thing. Their existence would imply official Mac support which would lead to what I have just talked about.

So I am sorry, but I do not think we will have an official formula. On the other hand, you are free to create one yourself in a forked project. I would also be willing to merge PRs and provide help with any problems to a reasonable extent.

@plajjan
Copy link
Author

plajjan commented Aug 19, 2022

No, I did not disable SSH but again, I haven't actually gotten to run any code with this yet... I'm not sure what part it is that you are expecting to fail around SSH. At least libssh is available on Mac via Homebrew, so surely something works!? :) Is this local system users check a libnetconf2 thing or a libssh thing? i.e. when can I expect something to fail? You say compilation should fail, but I am past that!?

Indeed, Mac does not run OpenSSL (I think it's LibreSSL) per default and Homebrew generally prefers to use the OS version of things, or at the very least not contaminate / collide with the OS on things, which is why OpenSSL is "keg only" in Homebrew speak. It is installed but not reachable system wide. Other applications built / installed with Homebrew can use OpenSSL as Homebrew manages the include & lib prefixes. So if you've tried to get things working on Mac and have failed, I think it might be worthwhile trying again with the help of Homebrew since it deals with some of the nastier areas for you.

I'll try to shape up my formulas and push it to a git repo so you can have a look at it too!

@plajjan
Copy link
Author

plajjan commented Aug 19, 2022

The one thing I have to change in libnetconf2 is to remove -lcrypt. It is required on Linux but AFAIU it is not required on MacOS. I got it working simply be removing those lines from the cmake config. Naturally, it should be fixed by another condition on macos (or perhaps only using -lcrypt on Linux?! do BSDs need it?)...

@michalvasko
Copy link
Member

I'm not sure what part it is that you are expecting to fail around SSH.

The last time I tried it, the header pwd.h was not available as weren't any of those functions.

Mac does not run OpenSSL (I think it's LibreSSL)

So I had some problems with that but I have probably not tried to install OpenSSL using homebrew.

The one thing I have to change in libnetconf2 is to remove -lcrypt.

I see, a Mac switch to not link it should be fine. It actually seems to be a part of BSD specs (based on my man page).

I'll try to shape up my formulas and push it to a git repo so you can have a look at it too!

Okay, that is a good start. Once everything is working we will see.

@plajjan
Copy link
Author

plajjan commented Aug 22, 2022

Right, -lcrypt seems part of BSD so available out of box on macos etc. I'm really not a cmake guy so I'd rather not try to fix it but if necessary I'll take a stab at it.

I have pushed my libyang & libnetconf2 Homebrew formulae to https://github.com/plajjan/homebrew-plajjan

What is a good test case to ensure that the libraries are properly installed? For example, in the libssh Homebrew formula, they have this little small program that they test compiling to ensure the library is properly installed: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libssh.rb#L34

@michalvasko
Copy link
Member

The libcrypt problem should be fixed but you will have to wait for another release if you want a tag. Other than that, libnetconf2 depends also on libpam. As for the test, you could write a similar small app with just server and client init and destroy functions, for example. Or compile the examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:question Issue is actually a question.
Projects
None yet
Development

No branches or pull requests

2 participants