Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2014 19:33:24 +0200
From:      "no@spam@mgedv.net" <nospam@mgedv.net>
To:        freebsd-questions@freebsd.org
Subject:   ksh93 static linking fails (ksh93, 10.0-STABLE, amd64)
Message-ID:  <53A71364.1060703@mgedv.net>

next in thread | raw e-mail | index | archive | help

hi,

i need to link ksh statically, but don't get it done.

i use ast-ksh-20120801 and INIT-20130524, as well as
the 3 patches from the freebsd ksh93 port.
CCFLAGS=CFLAGS=-O2 -pipe
LDFLAGS=-lm

dynamic linking successes with the follwing command:
[cwd=/build/arch/freebsd10.amd64/src/cmd/ksh93]
cc -O2 -pipe -lm -L. -L/build/arch/freebsd10.amd64/lib \
-o ksh pmain.o libshell.a \
/build/arch/freebsd10.amd64/lib/libdll.a \
/build/arch/freebsd10.amd64/lib/libast.a \
/build/arch/freebsd10.amd64/lib/libast.a \
/build/arch/freebsd10.amd64/lib/libcoshell.a \
/build/arch/freebsd10.amd64/lib/libast.a \
/build/arch/freebsd10.amd64/lib/libast.a \
/build/arch/freebsd10.amd64/lib/libcmd.a \
-lmd -lutil /build/arch/freebsd10.amd64/lib/libast.a \
-lmd -lutil /build/arch/freebsd10.amd64/lib/libast.a \
/build/arch/freebsd10.amd64/lib/libast.a \
/build/arch/freebsd10.amd64/lib/libast.a

my "final" static command (after many others):
cc -s -v -O2 -pipe -lm -static \
-L. -L./arch/freebsd10.amd64/lib \
-o ./ksh_static \
./arch/freebsd10.amd64/src/cmd/ksh93/pmain.o \
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a \
-lc -lm -lmd -lutil ./arch/freebsd10.amd64/lib/libdll.a \
./arch/freebsd10.amd64/lib/libcoshell.a \
./arch/freebsd10.amd64/lib/libcmd.a \
./arch/freebsd10.amd64/lib/libast.a

the errors from the command above are:
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x7c8): warning: powl has lower than advertised precision
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x3a8): warning: coshl has lower than advertised precision
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x3d8): warning: erfcl has lower than advertised precision
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x3c0): warning: erfl has lower than advertised precision
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x6f0): warning: lgammal has lower than advertised precision
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x888): warning: sinhl has lower than advertised precision
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x8d0): warning: tanhl has lower than advertised precision
./arch/freebsd10.amd64/src/cmd/ksh93/libshell.a(strdata.o):(.rodata+0x8e8): warning: tgammal has lower than advertised precision
./arch/freebsd10.amd64/lib/libast.a(malloc.o): In function `__calloc':
/build/src/lib/libast/vmalloc/malloc.c:(.text+0xfe0): multiple definition of `__calloc'
/usr/lib/libc.a(jemalloc_jemalloc.o):jemalloc_jemalloc.c:(.text+0x29a0): first defined here
./arch/freebsd10.amd64/lib/libast.a(malloc.o): In function `__free':
/build/src/lib/libast/vmalloc/malloc.c:(.text+0x1000): multiple definition of `__free'
/usr/lib/libc.a(jemalloc_jemalloc.o):jemalloc_jemalloc.c:(.text+0x54a0): first defined here
./arch/freebsd10.amd64/lib/libast.a(malloc.o): In function `__malloc':
/build/src/lib/libast/vmalloc/malloc.c:(.text+0x1010): multiple definition of `__malloc'
/usr/lib/libc.a(jemalloc_jemalloc.o):jemalloc_jemalloc.c:(.text+0x210): first defined here
./arch/freebsd10.amd64/lib/libast.a(malloc.o): In function `__realloc':
/build/src/lib/libast/vmalloc/malloc.c:(.text+0x1020): multiple definition of `__realloc'
/usr/lib/libc.a(jemalloc_jemalloc.o):jemalloc_jemalloc.c:(.text+0x3d00): first defined here
cc: error: linker command failed with exit code 1 (use -v to see invocation)

i tried re-arranging the -l<lib> stuff, changed the .a orders,
but still without final success. i managed to statically link
version 20120801, but the version is unstable and hangs itself.
i know i'm doing smth completely wrong here, but don't get it.
and please, i don't wanna discuss static linking at all ;-)

any ideas welcome ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53A71364.1060703>