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

Compiling on macos threw error, fixed it with gpt #171

Open
bdmorin opened this issue May 24, 2024 · 0 comments
Open

Compiling on macos threw error, fixed it with gpt #171

bdmorin opened this issue May 24, 2024 · 0 comments

Comments

@bdmorin
Copy link

bdmorin commented May 24, 2024

❯ uname -a
Darwin n0x.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

I have absolutely no idea if this was the correct thing to do, but I was getting this error when
trying to compile.

❯ make whois
cc -I/opt/homebrew/opt/curl/include -DHAVE_LIBIDN2 -I/opt/homebrew/Cellar/libidn2/2.3.7/include  -g -O2 -MM -MG *.c > Makefile.depend
perl make_ip_del.pl < ip_del_list > ip_del.h
perl make_ip6_del.pl < ip6_del_list > ip6_del.h
perl make_as_del.pl < as_del_list > as_del.h
perl make_new_gtlds.pl < new_gtlds_list > new_gtlds.h
perl make_tld_serv.pl < tld_serv_list > tld_serv.h
perl make_nic_handles.pl < nic_handles_list > nic_handles.h
cc -I/opt/homebrew/opt/curl/include -DHAVE_LIBIDN2 -I/opt/homebrew/Cellar/libidn2/2.3.7/include  -g -O2 -c whois.c
cc -I/opt/homebrew/opt/curl/include -DHAVE_LIBIDN2 -I/opt/homebrew/Cellar/libidn2/2.3.7/include  -g -O2 -c utils.c
utils.c:55:24: error: call to undeclared library function 'strdup' with type 'char *(const char *)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    argstring = NOFAIL(strdup(args));
                       ^
utils.c:55:24: note: include the header <string.h> or explicitly provide a declaration for 'strdup'
1 error generated.
make: *** [utils.o] Error 1

I have libiconv and libidn installed

I asked GPT and it said, just add char *strdup(const char *s); to utils.c and it worked.

❯ make whois
cc -I/opt/homebrew/opt/curl/include -DHAVE_LIBIDN2 -I/opt/homebrew/Cellar/libidn2/2.3.7/include  -g -O2 -c utils.c
cc -g -O2 -L/opt/homebrew/opt/curl/lib -o whois whois.o utils.o -L/opt/homebrew/Cellar/libidn2/2.3.7/lib -lidn2

Works great.

Again, this might have been the stupidest thing to do, I don't know.

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

No branches or pull requests

1 participant