pkun / klish

Other
7 stars 3 forks source link

cross-compiling to musl fails #3

Closed terefang closed 3 years ago

terefang commented 3 years ago

version 2.2.3

configure command

ac_cv_header_dlfcn_h=no ./configure \
    --host=x86_64-linux-musl \
    --prefix=/usr/klish \
    --disable-shared \
    --without-lua \
    --without-libroxml \
    --with-libexpat=/usr/klish \
    --without-libxml2 \
    --without-libxslt \
    --with-internal-getopt

make command and error-output

make -j 1 LDFLAGS+=-all-static DESTDIR='${project.build.directory}/${project.artifactId}/root' install
....
 libtool: compile:  x86_64-linux-musl-gcc -DHAVE_CONFIG_H -I. -I. -I/usr/klish/include -g -O2 -MT clish/shell/libclish_la-shell_execute.lo -MD -MP -MF clish/shell/.deps/libclish_la-shell_execute.Tpo -c clish/shell/shell_execute.c -o clish/shell/libclish_la-shell_execute.o
 clish/shell/shell_execute.c:23:13: error: conflicting types for ‘sigignore’
    23 | static void sigignore(int signo)
       |             ^~~~~~~~~
 In file included from /u/fredo/bin/x86_64-linux-musl-native/include/sys/wait.h:26,
                  from clish/shell/shell_execute.c:17:
 /u/fredo/bin/x86_64-linux-musl-native/include/signal.h:237:5: note: previous declaration of ‘sigignore’ was here
   237 | int sigignore(int);
       |     ^~~~~~~~~
make: *** [clish/shell/libclish_la-shell_execute.lo] Error 1
Makefile:1804: recipe for target 'clish/shell/libclish_la-shell_execute.lo' failed

seams like musl libc sigignore declaration is clashing with your internal handler name.

could you rename the handler function in file clish/shell/shell_execute.c on lines 23 and 364 ?

terefang commented 3 years ago

i have used the following patch for remediation

--- clish/shell/shell_execute.c.old 2021-05-21 18:39:57.000000000 +0200
+++ clish/shell/shell_execute.c 2021-09-19 12:11:35.173528539 +0200
@@ -20,7 +20,7 @@
 #include <fcntl.h>

 /* Empty signal handler to ignore signal but don't use SIG_IGN. */
-static void sigignore(int signo)
+static void sig_ignore_handler(int signo)
 {
    signo = signo; /* Happy compiler */
    return;
@@ -361,7 +361,7 @@
     */
    sa.sa_flags = 0;
    sigemptyset(&sa.sa_mask);
-   sa.sa_handler = sigignore; /* Empty signal handler */
+   sa.sa_handler = sig_ignore_handler; /* Empty signal handler */
    sigaction(SIGINT, &sa, &old_sigint);
    sigaction(SIGQUIT, &sa, &old_sigquit);
    sigaction(SIGHUP, &sa, &old_sighup);
pkun commented 3 years ago

Thanks for the patch. Applied. See branch 2.2

terefang commented 3 years ago

sorry i dont see any changes on github ... is it out of sync ?

pkun commented 3 years ago

Yes. The real website and repository are: http://klish.libcode.org https://src.libcode.org/pkun/klish/src/2.2 (For stable branch) https://src.libcode.org/klish (For new unfinished version)

You can find these links within README. For your changes see branch 2.2

terefang commented 3 years ago

thx