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

error building tmate-ssh-server #75

Open
ScrumpyJack opened this issue May 16, 2020 · 1 comment
Open

error building tmate-ssh-server #75

ScrumpyJack opened this issue May 16, 2020 · 1 comment

Comments

@ScrumpyJack
Copy link

ScrumpyJack commented May 16, 2020

I get this error building tmate-ssh-server from latest source using musl-linux c libraries.

Any suggestions would be welcome

CC tmate-main.o
tmate-main.c: In function 'get_in_jail':
tmate-main.c:245:6: warning: implicit declaration of function 'unshare'; did you mean 'usage'? [-Wimplicit-function-declaration]
if (unshare(CLONE_NEWPID | CLONE_NEWIPC | CLONE_NEWNS | CLONE_NEWNET) < 0)
^~~~~~~
usage
tmate-main.c:245:6: warning: nested extern declaration of 'unshare' [-Wnested-externs]
tmate-main.c:245:14: error: 'CLONE_NEWPID' undeclared (first use in this function)
if (unshare(CLONE_NEWPID | CLONE_NEWIPC | CLONE_NEWNS | CLONE_NEWNET) < 0)
^~~~~~~~~~~~
tmate-main.c:245:14: note: each undeclared identifier is reported only once for each function it appears in
tmate-main.c:245:29: error: 'CLONE_NEWIPC' undeclared (first use in this function)
if (unshare(CLONE_NEWPID | CLONE_NEWIPC | CLONE_NEWNS | CLONE_NEWNET) < 0)
^~~~~~~~~~~~
tmate-main.c:245:44: error: 'CLONE_NEWNS' undeclared (first use in this function)
if (unshare(CLONE_NEWPID | CLONE_NEWIPC | CLONE_NEWNS | CLONE_NEWNET) < 0)
^~~~~~~~~~~
tmate-main.c:245:58: error: 'CLONE_NEWNET' undeclared (first use in this function); did you mean 'SOL_DECNET'?
if (unshare(CLONE_NEWPID | CLONE_NEWIPC | CLONE_NEWNS | CLONE_NEWNET) < 0)
^~~~~~~~~~~~
SOL_DECNET
tmate-main.c:253:6: warning: implicit declaration of function 'setresgid'; did you mean 'setregid'? [-Wimplicit-function-declaration]
if (setresgid(gid, gid, gid) < 0)
^~~~~~~~~
setregid
tmate-main.c:253:6: warning: nested extern declaration of 'setresgid' [-Wnested-externs]
tmate-main.c:264:6: warning: implicit declaration of function 'setresuid'; did you mean 'setreuid'? [-Wimplicit-function-declaration]
if (setresuid(uid, uid, uid) < 0)
^~~~~~~~~
setreuid
tmate-main.c:264:6: warning: nested extern declaration of 'setresuid' [-Wnested-externs]
tmate-main.c: At top level:
cc1: warning: unrecognized command line option '-Wno-null-pointer-arithmetic'
make: *** [Makefile:992: tmate-main.o] Error 1

@jsarenik
Copy link

On Alpine Linux x86_64 I use following patch. Only two lines are really fixing this, the rest is updating configure.ac for Autoconf to be happy.

commit 4941e65b
Author: Jan Sarenik <[email protected]>
Date:   Thu Aug 25 10:14:55 2022 +0000

    Fix musl-libc compilation and update autoconf

diff --git a/Makefile.am b/Makefile.am
index 91ba01bd..afc80146 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,9 +17,7 @@ CPPFLAGS += @XOPEN_DEFINES@ -DTMUX_CONF="\"$(sysconfdir)/tmux.conf\""
 
 # glibc as usual does things ass-backwards and hides useful things by default,
 # so everyone has to add this.
-if IS_GLIBC
 CFLAGS += -D_GNU_SOURCE
-endif
 
 if IS_DEVENV
 CFLAGS += -DDEVENV
diff --git a/configure.ac b/configure.ac
index 2035470f..bd1565ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 # configure.ac
 
-AC_INIT(tmate-ssh-server, 2.3.0)
+AC_INIT([tmate-ssh-server],[2.3.0])
 
 AM_SILENT_RULES([yes])
 AC_CONFIG_AUX_DIR(etc)
@@ -26,7 +26,7 @@ test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
 
 AC_ARG_ENABLE(
 	devenv,
-	AC_HELP_STRING(--enable-devenv, "dev env (port 2200, no random tokens)"),
+	AS_HELP_STRING([--enable-devenv],["dev env (port 2200, no random tokens)"]),
 	found_devenv=$enable_devenv
 )
 AM_CONDITIONAL(IS_DEVENV, test "x$found_devenv" = xyes)
@@ -35,7 +35,7 @@ AM_CONDITIONAL(IS_DEVENV, test "x$found_devenv" = xyes)
 found_debug=yes
 AC_ARG_ENABLE(
 	debug,
-	AC_HELP_STRING(--enable-debug, enable debug build flags),
+	AS_HELP_STRING([--enable-debug],[enable debug build flags]),
 	found_debug=$enable_debug
 )
 AM_CONDITIONAL(IS_DEBUG, test "x$found_debug" = xyes)
@@ -43,7 +43,7 @@ AM_CONDITIONAL(IS_DEBUG, test "x$found_debug" = xyes)
 # Is this --enable-coverage?
 AC_ARG_ENABLE(
 	coverage,
-	AC_HELP_STRING(--enable-coverage, enable coverage build flags),
+	AS_HELP_STRING([--enable-coverage],[enable coverage build flags]),
 	found_coverage=$enable_coverage
 )
 AM_CONDITIONAL(IS_COVERAGE, test "x$found_coverage" = xyes)
@@ -51,7 +51,7 @@ AM_CONDITIONAL(IS_COVERAGE, test "x$found_coverage" = xyes)
 # Is this a static build?
 AC_ARG_ENABLE(
 	static,
-	AC_HELP_STRING(--enable-static, create a static build),
+	AS_HELP_STRING([--enable-static],[create a static build]),
 	found_static=$enable_static
 )
 if test "x$found_static" = xyes; then
@@ -224,31 +224,23 @@ AC_CHECK_FUNCS([setresuid setresgid setreuid setregid])
 
 # Check for b64_ntop.
 AC_MSG_CHECKING(for b64_ntop)
-AC_TRY_LINK(
-	[
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 		#include <sys/types.h>
 		#include <netinet/in.h>
 		#include <resolv.h>
-	],
-	[b64_ntop(NULL, 0, NULL, 0);],
-	found_b64_ntop=yes,
-	found_b64_ntop=no
-)
+	]], [[b64_ntop(NULL, 0, NULL, 0);]])],[found_b64_ntop=yes],[found_b64_ntop=no
+])
 if test "x$found_b64_ntop" = xno; then
 	AC_MSG_RESULT(no)
 
 	AC_MSG_CHECKING(for b64_ntop with -lresolv)
 	LIBS="$LIBS -lresolv"
-	AC_TRY_LINK(
-		[
+	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 			#include <sys/types.h>
 			#include <netinet/in.h>
 			#include <resolv.h>
-		],
-		[b64_ntop(NULL, 0, NULL, 0);],
-		found_b64_ntop=yes,
-		found_b64_ntop=no
-	)
+		]], [[b64_ntop(NULL, 0, NULL, 0);]])],[found_b64_ntop=yes],[found_b64_ntop=no
+	])
 	if test "x$found_b64_ntop" = xno; then
 		AC_MSG_RESULT(no)
 	fi
@@ -598,4 +590,5 @@ AM_CONDITIONAL(IS_HPUX, test "x$PLATFORM" = xhpux)
 AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown)
 
 # autoconf should create a Makefile.
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

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

2 participants