Skip to contentSkip to conversation

package/tmux: fix BR2_SHARED_STATIC_LIBS

PATCH Applied Fabrice Fontaine 3 participants 4 messages Feb 19, 2023 – Feb 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/tmux: fix BR2_SHARED_STATIC_LIBS

tmux uses custom --enable-static option, instead of standard libtool directive resulting in the following build failure with systemd or utf8proc raised since commits 1f618aa388535181c281c85e2b5264532de4ef0f and e279599d255a79c08ef20b97b96eb248689d52a9:

checking for utf8proc.h... yes
checking for library containing utf8proc_charwidth... no
configure: error: "utf8proc not found"

In file included from tmux.h:34,

                 from alerts.c:23:
compat.h:379:18: error: conflicting types for 'forkpty'; have 'pid_t(int *, char *, struct termios *, struct winsize *)' {aka 'int(int *, char *, struct termios *, struct winsize *)'}
  379 | pid_t            forkpty(int *, char *, struct termios *, struct winsize *);
      |                  ^~~~~~~

Link to (closed) upstream issue:
https://github.com/tmux/tmux/issues/3290

Fixes:
- http://autobuild.buildroot.org/results/6e8523d8d514bf6d8fc3377d05e5edbe7fc2d5bb
- http://autobuild.buildroot.org/results/cba06f3bb6d9be25e91f56c390a70ddf9904832e

---
 package/tmux/tmux.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/tmux/tmux.mk +6 -0
index 47ee9b16ca..af06c8570b 100644
@@ -25,6 +25,12 @@ else
 TMUX_CONF_OPTS += --disable-utf8proc
 endif
 
+# tmux uses custom --enable-static option, instead of standard libtool
+# directive resulting in a build failure with systemd or utf8proc
+ifeq ($(BR2_SHARED_STATIC_LIBS),y)
+TMUX_CONF_OPTS += --disable-static
+endif
+
 # Add /usr/bin/tmux to /etc/shells otherwise some login tools like dropbear
 # can reject the user connection. See man shells.
 define TMUX_ADD_TMUX_TO_SHELLS
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Fabrice,

Quoted 5 lines · On Mon, 20 Feb 2023 00:23:01 +0100 Fabrice Fontaine…

tmux uses custom --enable-static option, instead of standard libtool directive resulting in the following build failure with systemd or utf8proc raised since commits 1f618aa388535181c281c85e2b5264532de4ef0f and e279599d255a79c08ef20b97b96eb248689d52a9:

I am rather confused by the reasoning here.

Quoted 3 lines

checking for utf8proc.h... yes
checking for library containing utf8proc_charwidth... no
configure: error: "utf8proc not found"

So this one is:

http://autobuild.buildroot.net/results/6e8/6e8523d8d514bf6d8fc3377d05e5edbe7fc2d5bb/build-end.log
http://autobuild.buildroot.net/results/623/62309091c9da69eb29c3e9464aa95d089ce886f8/build-end.log

I think here the problem is indeed that tmux interprets --enable-static as "please provide a statically linked binary" instead of the standard "please build/install static libraries".

So, when it tries to detect libutf8proc, it doesn't find it:

/home/autobuild/autobuild/instance-13/output-1/host/lib/gcc/or1k-buildroot-linux-musl/11.3.0/../../../../or1k-buildroot-linux-musl/bin/ld: cannot find -lutf8proc: No such file or directory

because utf8proc is based on CMake, and CMake is not able to build both shared and static libraries, so in the BR2_STATIC_SHARED_LIBS=y case, it only installs shared libraries. Because the above utf8proc library test is done with -static, it requires a static variant of libutf8proc, which isn't there.

So indeed, for this case, it makes sense to not pass --enable-static to tmux, but it's both due to tmux having a non-standard behavior for --enable-static *AND* the fact that utf8proc also doesn't behave properly in the BR2_STATIC_SHARED_LIBS=y case.

Quoted 5 lines

In file included from tmux.h:34,

                 from alerts.c:23:
compat.h:379:18: error: conflicting types for 'forkpty'; have 'pid_t(int *, char *, struct termios *, struct winsize *)' {aka 'int(int *, char *, struct termios *, struct winsize *)'}
  379 | pid_t            forkpty(int *, char *, struct termios *, struct winsize *);
      |                  ^~~~~~~

However this one, I am really, really confused as to how it can be related to BR2_STATIC_SHARED_LIBS and --enable-static. Could you provide some more details on the reasoning?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 49 lines · Thomas Petazzoni

Hello Fabrice,

Quoted 5 lines · On Mon, 20 Feb 2023 00:23:01 +0100 Fabrice Fontaine…

tmux uses custom --enable-static option, instead of standard libtool directive resulting in the following build failure with systemd or utf8proc raised since commits 1f618aa388535181c281c85e2b5264532de4ef0f and e279599d255a79c08ef20b97b96eb248689d52a9:

I am rather confused by the reasoning here.

Quoted 3 lines

checking for utf8proc.h... yes
checking for library containing utf8proc_charwidth... no
configure: error: "utf8proc not found"

So this one is:

http://autobuild.buildroot.net/results/6e8/6e8523d8d514bf6d8fc3377d05e5edbe7fc2d5bb/build-end.log

http://autobuild.buildroot.net/results/623/62309091c9da69eb29c3e9464aa95d089ce886f8/build-end.log

I think here the problem is indeed that tmux interprets --enable-static as "please provide a statically linked binary" instead of the standard "please build/install static libraries".

So, when it tries to detect libutf8proc, it doesn't find it:

/home/autobuild/autobuild/instance-13/output-1/host/lib/gcc/or1k-buildroot-linux-musl/11.3.0/../../../../or1k-buildroot-linux-musl/bin/ld:
cannot find -lutf8proc: No such file or directory

because utf8proc is based on CMake, and CMake is not able to build both shared and static libraries, so in the BR2_STATIC_SHARED_LIBS=y case, it only installs shared libraries. Because the above utf8proc library test is done with -static, it requires a static variant of libutf8proc, which isn't there.

So indeed, for this case, it makes sense to not pass --enable-static to tmux, but it's both due to tmux having a non-standard behavior for --enable-static *AND* the fact that utf8proc also doesn't behave properly in the BR2_STATIC_SHARED_LIBS=y case.

Quoted 3 lines

In file included from tmux.h:34,

                 from alerts.c:23:

compat.h:379:18: error: conflicting types for 'forkpty'; have 'pid_t(int

*, char *, struct termios *, struct winsize *)' {aka 'int(int *, char *, struct termios *, struct winsize *)'}

Quoted 9 lines
Quoted 1 line

379 | pid_t forkpty(int *, char *, struct termios *, struct

winsize *);

Quoted 1 line
      |                  ^~~~~~~

However this one, I am really, really confused as to how it can be related to BR2_STATIC_SHARED_LIBS and --enable-static. Could you provide some more details on the reasoning?

This is the same issue, availability of forkpty in systemd is wrongly detected because of --static.
Here is an extract of
http://autobuild.buildroot.org/results/cba/cba06f3bb6d9be25e91f56c390a70ddf9904832e//tmux-3.3a/config.log
:

configure:7278:
/home/autobuild/autobuild/instance-12/output-1/host/bin/powerpc64-buildroot-linux-gnu-gcc
-o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=2 -D_DEFAULT_SOURCE
-D_XOPEN_SOURCE=600 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -static conftest.c -lutil
-L/home/autobuild/autobuild/instance-12/output-1/host/bin/../powerpc64-buildroot-linux-gnu/sysroot/usr/lib
-lsystemd -lncurses -L/home/autobuild/autobuild/instance-12/output-1/host/bin/../powerpc64-buildroot-linux-gnu/sysroot/usr/lib
-levent_core -lm >&5 /home/autobuild/autobuild/instance-12/output-1/host/lib/gcc/powerpc64-buildroot-linux-gnu/11.3.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld:
cannot find -lsystemd

Quoted 9 lines

Thanks!

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Best Regards,

Fabrice

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Fabrice Fontaine

Fabrice, All,

On 2023-02-20 00:23 +0100, Fabrice Fontaine spake thusly:

Quoted 2 lines

tmux uses custom --enable-static option, instead of standard libtool directive

In fact, the purpose is also different: libtool's --enable-static drives whether to generate static libraries, while tmux' --enable-static drives whether to link against static libraries.

So, not unrelated, but still different.

Quoted 15 lines

resulting in the following build failure with systemd or utf8proc raised since commits 1f618aa388535181c281c85e2b5264532de4ef0f and e279599d255a79c08ef20b97b96eb248689d52a9:

checking for utf8proc.h... yes
checking for library containing utf8proc_charwidth... no
configure: error: "utf8proc not found"

In file included from tmux.h:34,

                 from alerts.c:23:
compat.h:379:18: error: conflicting types for 'forkpty'; have 'pid_t(int *, char *, struct termios *, struct winsize *)' {aka 'int(int *, char *, struct termios *, struct winsize *)'}
  379 | pid_t            forkpty(int *, char *, struct termios *, struct winsize *);
      |                  ^~~~~~~
Quoted 8 lines

Link to (closed) upstream issue:
https://github.com/tmux/tmux/issues/3290

Fixes:
- http://autobuild.buildroot.org/results/6e8523d8d514bf6d8fc3377d05e5edbe7fc2d5bb
- http://autobuild.buildroot.org/results/cba06f3bb6d9be25e91f56c390a70ddf9904832e

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 28 lines
---
 package/tmux/tmux.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/tmux/tmux.mk +6 -0
index 47ee9b16ca..af06c8570b 100644
@@ -25,6 +25,12 @@ else
 TMUX_CONF_OPTS += --disable-utf8proc
 endif
 
+# tmux uses custom --enable-static option, instead of standard libtool
+# directive resulting in a build failure with systemd or utf8proc
+ifeq ($(BR2_SHARED_STATIC_LIBS),y)
+TMUX_CONF_OPTS += --disable-static
+endif
+
 # Add /usr/bin/tmux to /etc/shells otherwise some login tools like dropbear
 # can reject the user connection. See man shells.
 define TMUX_ADD_TMUX_TO_SHELLS
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot