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

libidn not found with Homebrew on Mac #129

Open
ondohotola opened this issue Dec 22, 2021 · 20 comments · Fixed by #210
Open

libidn not found with Homebrew on Mac #129

ondohotola opened this issue Dec 22, 2021 · 20 comments · Fixed by #210
Labels
T-Feature Type: New feature in software or test case description T-Question Type: Incoming question
Milestone

Comments

@ondohotola
Copy link

I am unable get Zonemaster:LDNS to compile on iMac/MacPro x86_64 MOnterey 12.1 with CPAN updated to latest.

It does not find libidn, which is installed from Homebrew.

From what I see it's just something similar like --prefix-openssl which needs to be added to the Makefile.PL, even though I see this in /usr/local

lrwxr-xr-x  1 el  admin  40 Jul 25 23:02 include/idn-free.h -> ../Cellar/libidn/1.38/include/idn-free.h
lrwxr-xr-x  1 el  admin  39 Jul 25 23:02 include/idn-int.h -> ../Cellar/libidn/1.38/include/idn-int.h
lrwxr-xr-x  1 el  admin  38 Jul 21 17:49 include/idn2.h -> ../Cellar/libidn2/2.3.2/include/idn2.h
lrwxr-xr-x  1 el  admin  36 Jul 25 23:02 include/idna.h -> ../Cellar/libidn/1.38/include/idna.h
lrwxr-xr-x  1 el  admin  41 Jul 25 23:02 lib/libidn.12.dylib -> ../Cellar/libidn/1.38/lib/libidn.12.dylib
lrwxr-xr-x  1 el  admin  34 Jul 25 23:02 lib/libidn.a -> ../Cellar/libidn/1.38/lib/libidn.a
lrwxr-xr-x  1 el  admin  38 Jul 25 23:02 lib/libidn.dylib -> ../Cellar/libidn/1.38/lib/libidn.dylib
lrwxr-xr-x  1 el  admin  43 Jul 21 17:49 lib/libidn2.0.dylib -> ../Cellar/libidn2/2.3.2/lib/libidn2.0.dylib
lrwxr-xr-x  1 el  admin  37 Jul 21 17:49 lib/libidn2.a -> ../Cellar/libidn2/2.3.2/lib/libidn2.a
lrwxr-xr-x  1 el  admin  41 Jul 21 17:49 lib/libidn2.dylib -> ../Cellar/libidn2/2.3.2/lib/libidn2.dylib

Thanks, el

@ghost
Copy link

ghost commented Aug 24, 2022

Could you test the proposal in #152 to see if this solves your issue? (I don't have access to Mac).

@matsduf matsduf modified the milestones: v2022.2, v2023.1 Dec 20, 2022
@matsduf matsduf modified the milestones: v2023.1, v2023.2 Jun 26, 2023
@matsduf matsduf modified the milestones: v2023.2, v2024.1 Mar 19, 2024
@matsduf matsduf modified the milestones: v2024.1, v2024.2 Jul 3, 2024
@marc-vanderwal
Copy link
Contributor

@ondohotola Do you have any news on this issue? Have you had the chance to test the proposed fix?

@ondohotola
Copy link
Author

ondohotola commented Sep 6, 2024

Thank you.

On my M2 MacMini the following worked (your milage will vary, and if it squeals about missing Perl Modules, just install them with cpan):

cpan Zonemaster::LDNS (which fails but that's fine)

cd $HOME/.cpan/build/Zonemaster-LDNS-4.0.2-0
HB=$(brew --prefix)
OSV=$(openssl --version|awk '{print $2}')
perl Makefile.PL \
   --prefix-openssl=$HB/Cellar/openssl@3/$OSV \
   --libidn-inc=$HB/include \
   --libidn-lib=$HB//lib
make
make test
make install
cpan Zonemaster::Engine
cpan Zonemaster::CLI

zonemaster-cli --version then shows

Zonemaster-CLI version v7.0.0
Zonemaster-Engine version v6.0.0
Zonemaster-LDNS version 4.0.2
NL NetLabs LDNS version 1.8.3

and zonemaster-cli --level ERROR na

shows

Seconds Level    Message
======= ======== =======
  65.90 ERROR    It cannot be determined if the child zone is signed or not.

whereas the Web GUI shows no error

@matsduf
Copy link
Contributor

matsduf commented Sep 6, 2024

Can you run again with --show_testcase --level INFO?

@ondohotola
Copy link
Author

I'll email the output to you off line, as I don't want to post it her.

@ondohotola
Copy link
Author

ondohotola commented Sep 12, 2024

Just for the record Mats and I are indeed engaging off line :-)-O

@ondohotola
Copy link
Author

It compiles out of the box on the Intel Mac, which leads me to requesting that perhaps the configure step should look not only for /usr/local but also for /opt/homebrew or even better test for Homebrew installation

if [ "$(command -v brew)" ]; then
   HB=$(brew --prefix)
fi

and

OSV=$(openssl --version|awk '{print $2}')

and if it exist add $HB to the tests like I did above, ie something like

perl Makefile.PL \
   --prefix-openssl=$HB/Cellar/openssl@3/$OSV \
   --libidn-inc=$HB/include \
   --libidn-lib=$HB/lib

@marc-vanderwal
Copy link
Contributor

We might want to consider using pkg-config to discover potential locations of the required libraries. Using pkg-config is more likely to be portable across *nix platforms.

@ondohotola
Copy link
Author

That should work

@ondohotola
Copy link
Author

ondohotola commented Nov 11, 2024

Any update (about the pkg-config)?

@marc-vanderwal
Copy link
Contributor

marc-vanderwal commented Nov 12, 2024

Any update (about the pkg-config)?

I’ve started looking into it.

Just to be sure whether using pkg-config might fix your issue, can you please check if the two commands below complete without any errors on your system?

pkg-config --cflags --libs libidn2
pkg-config --cflags --libs openssl

@marc-vanderwal
Copy link
Contributor

A pull request (#210) is ready. Could you please tell me if it solves your issue?

marc-vanderwal added a commit that referenced this issue Nov 15, 2024
Use ExtUtils::PkgConfig to discover the CFLAGS and LDFLAGS for external libraries
@ondohotola
Copy link
Author

I have downloaded the source as ZIP and cloned the GH. on both I get

include /Users/el/Downloads/zonemaster-ldns-master/inc/Module/Install.pm
include inc/Module/Install/Metadata.pm
include inc/Module/Install/Base.pm
include inc/Module/Install/Makefile.pm
include inc/Module/Install/XSUtil.pm
include inc/Module/Install/Can.pm
Writing ppport.h
Can't link/include C library 'openssl/crypto.h', 'crypto', aborting.

@ondohotola
Copy link
Author

ondohotola commented Nov 23, 2024

If I do something like

cpan Zonemaster::LDNS
cd $HOME/.cpan/build/Zonemaster-LDNS-4.0.2-0
perl Makefile.PL --prefix-openssl=$(pkg-config --variable=prefix openssl) --libidn-inc=$(pkg-config --variable=includedir libidn2) --libidn-lib=$(pkg-config --variable=libdir libidn2)
make
make test 
make install

it works, compiles, tests and installs

@matsduf
Copy link
Contributor

matsduf commented Nov 24, 2024

Did you download the zip file for the develop branch, https://github.com/zonemaster/zonemaster-ldns/archive/refs/heads/develop.zip?

The change is not yet on CPAN. I will be at next release in a few weeks.

I would be good to know if it works for you. If you prefer I could create a dist package of develop branch that can be installed by cpanm.

@matsduf matsduf added the T-Feature Type: New feature in software or test case description label Nov 24, 2024
@ondohotola
Copy link
Author

ondohotola commented Nov 24, 2024

perl Makefile.PL
include /Users/el/Downloads/zonemaster-ldns-develop/inc/Module/Install.pm
include inc/Module/Install/Metadata.pm
include inc/Module/Install/Base.pm
include inc/Module/Install/Makefile.pm
include inc/Module/Install/XSUtil.pm
include inc/Module/Install/Can.pm
Writing ppport.h
Adding CFLAGS for OpenSSL using pkg-config: -I/opt/homebrew/Cellar/openssl@3/3.4.0/include
'-I/opt/homebrew/Cellar/openssl@3/3.4.0/include' not found: No such file or directory
Adding LDFLAGS for OpenSSL using pkg-config: -L/opt/homebrew/Cellar/openssl@3/3.4.0/lib -lssl -lcrypto
Can't link/include C library 'openssl/crypto.h', 'crypto', aborting.

and

ls -las /opt/homebrew/Cellar/openssl@3/3.4.0/include/openssl/crypto.h
56 -rw-r--r--@ 1 el  admin  25214 Oct 22 14:26 /opt/homebrew/Cellar/openssl@3/3.4.0/include/openssl/crypto.h

@marc-vanderwal
Copy link
Contributor

Hi @ondohotola, thanks for your feedback! I made a mistake that I failed to catch during my own testing. Can you try applying the change in #213 and see if it works?

@ondohotola
Copy link
Author

You are most welcome.

Do I pull the development ZIP again?

@marc-vanderwal
Copy link
Contributor

If you want to download a ZIP file, you should download this one: https://github.com/marc-vanderwal/zonemaster-ldns/archive/refs/heads/bugfix/%23129-part-3.zip.

Or you can patch the Makefile.PL you already have if you feel comfortable enough. I’ve just changed a handful of lines.

@ondohotola
Copy link
Author

Oh, I can do a little Perl, but I will do it on the ZIP file so we know it works out of box

Thanks.

marc-vanderwal added a commit that referenced this issue Nov 25, 2024
Document new dependency on ExtUtils::PkgConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Feature Type: New feature in software or test case description T-Question Type: Incoming question
Projects
None yet
3 participants