Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jul 2020 20:59:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 247983] shells/bash: static option fails to link with duplicate symbol
Message-ID:  <bug-247983-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D247983

            Bug ID: 247983
           Summary: shells/bash: static option fails to link with
                    duplicate symbol
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ehaupt@FreeBSD.org
          Reporter: michael.osipov@siemens.com
             Flags: maintainer-feedback?(ehaupt@FreeBSD.org)
          Assignee: ehaupt@FreeBSD.org

I get the following when linking shells/bash statically or shells/bash-stat=
ic:
> cc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob  -L./lib/t=
ilde  -L./lib/sh  -fstack-protector-strong  -static  -O2 -pipe  -DLIBICONV_=
PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-alias=
ing  -Wno-parentheses -Wno-format-security  -static -o bash shell.o eval.o =
y.tab.o general.o make_cmd.o print_cmd.o   dispose_cmd.o execute_cmd.o vari=
ables.o copy_cmd.o error.o  expr.o flags.o jobs.o subst.o hashcmd.o hashlib=
.o mailcheck.o  trap.o input.o unwind_prot.o pathexp.o sig.o test.o version=
.o  alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o  ba=
shline.o  list.o stringlib.o locale.o findcmd.o redir.o  pcomplete.o pcompl=
ib.o syntax.o xmalloc.o  -lbuiltins -lglob -lsh -lreadline -lhistory -lterm=
cap  -ltilde  /usr/local/lib/libintl.a   -L/usr/local/lib
> ld: error: duplicate symbol: mktime
> >>> defined at mktime.c
> >>>            mktime.o:(mktime) in archive ./lib/sh/libsh.a
> >>> defined at localtime.c:2115 (/usr/src/contrib/tzcode/stdtime/localtim=
e.c:2115)
> >>>            localtime.o:(.text+0x8F0) in archive /usr/lib/libc.a
> cc: error: linker command failed with exit code 1 (use -v to see invocati=
on)

I run inside a jail:
> # freebsd-version
> 12.1-RELEASE-p7

jailhost is:
> FreeBSD bsd1srv1j 12.1-STABLE FreeBSD 12.1-STABLE r363030 GENERIC  amd64

At which revision of base this did break I cannot tell. An ideal solution w=
ould
be to detect in configure.ac that libc already comes with mktime(). My naive
solution was to patch two Makefiles:
Makefile.in and lib/sh/Makefile.in. I have basically removed all references=
 to
mktime .c .o and alike:

Index: files/patch-Makefile.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- files/patch-Makefile.in     (revision 542223)
+++ files/patch-Makefile.in     (working copy)
@@ -1,5 +1,23 @@
---- Makefile.in.orig   2018-05-25 12:47:09 UTC
+--- Makefile.in.orig   2020-07-14 20:56:27 UTC
 +++ Makefile.in
+-              ${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \
++              ${SH_LIBSRC}/strftime.c \
Index: files/patch-lib_sh_Makefile.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- files/patch-lib_sh_Makefile.in      (nonexistent)
+++ files/patch-lib_sh_Makefile.in      (working copy)
@@ -0,0 +1,37 @@
+--- lib/sh/Makefile.in.orig    2020-07-14 20:56:40 UTC
++++ lib/sh/Makefile.in
+@@ -89,7 +89,7 @@ CSOURCES =3D clktck.c clock.c getcwd.c getenv.c oslib.c
+-         mktime.c strftime.c mbschr.c zcatfd.c zmapfd.c winsize.c eaccess=
.c \
++         strftime.c mbschr.c zcatfd.c zmapfd.c winsize.c eaccess.c \
+@@ -164,7 +164,6 @@ mbscasecmp.o: mbscasecmp.c
+-mktime.o: mktime.c
+@@ -242,7 +241,6 @@ mbscasecmp.o: ${BUILD_DIR}/config.h
+-mktime.o: ${BUILD_DIR}/config.h
+@@ -599,9 +597,6 @@ dprintf.o: ${BASHINCDIR}/stdc.h
+-
+-mktime.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
+-mktime.o: ${BASHINCDIR}/stdc.h

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-247983-7788>