younix/ucspi

macOS build error: no execvpe

Closed this issue · 3 comments

With "1.7" (at commit 329110310c71a08a942b4a36613b6db090df65f4) on macOS Big Sur x86_64:

clang -O2 -I/opt/pkg/include -D_DARWIN_C_SOURCE -std=c99 -pedantic -Wall -Wextra -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -I/opt/pkg/include  -c -o tlsc.o tlsc.c
tlsc.c:256:3: warning: implicit declaration of function 'execvpe' is invalid in C99 [-Wimplicit-function-declaration]
                execvpe(prog, argv, environ);
                ^
1 warning generated.
clang -L/opt/pkg/lib -lcrypto `pkg-config --libs libtls libssl` -o tlsc tlsc.o -ltls `pkg-config --libs libssl`
Undefined symbols for architecture x86_64:
  "_execvpe", referenced from:
      _main.cold.23 in tlsc.o
ld: symbol(s) not found for architecture x86_64

I have no idea whether this workaround is correct, but it gets us past the build error:

--- tlsc.c.orig 2016-09-21 22:05:29.000000000 +0000
+++ tlsc.c
@@ -252,8 +252,8 @@ main(int argc, char *argv[], char *envp[

                if (close(pi[PIPE_WRITE]) < 0) err(EXIT_FAILURE, "close");
                if (close(po_read) < 0) err(EXIT_FAILURE, "close");
-               execvpe(prog, argv, environ);
-               err(EXIT_FAILURE, "execvpe");
+               execvp(prog, argv);
+               err(EXIT_FAILURE, "execvp");
        default: break; /* parent */
        }

Tribblix m25 also lacks execvpe().

Also happy to provide SSH access to a macOS host (for this and #10).

Fixed. Thanks for the suggestion.