Another Relocation Truncated Error


Any help with this?
I'm just trying to build from source on Sailfish OS. Program is Ckermit.

Output is
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  make[1]: Entering directory '/home/defaul
tuser/ckermit'
Making C-Kermit "9.0.302" for Linux 1.2 o
r later...
IMPORTANT: Read the comments in the linux
section of the
makefile if you have trouble.
make xermit KTARGET=${KTARGET:-linuxa} "C
C = gcc" "CC2 = gcc" \
"CFLAGS = -O -DLINUX -pipe -funsigned-cha
r -DFNFLOAT -DCK_POSIX_SIG \
-DCK_NEWTERM -DTCPSOCKET -DLINUXFSSTND -D
NOCOTFMC -DPOSIX \
-DUSE_STRERROR -DCK_NCURSES  -I/usr/inclu
de/ncurses -DHAVE_PTMX   -DHAVE_OPENPTY -
D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-DHAVE_CRYPT_H " "LNKFLAGS = " \
"LIBS = -lncurses -lutil -lresolv -lcrypt
-lm"
make[2]: Entering directory '/home/defaul
tuser/ckermit'
gcc  -o wermit \
ckcmai.o ckclib.o ckutio.o ckufio
.o \
ckcfns.o ckcfn2.o ckcfn3.o ckuxla
.o \
ckcpro.o ckucmd.o ckuus2.o ckuus3
.o \
ckuus4.o ckuus5.o ckuus6.o ckuus7
.o \
ckuusx.o ckuusy.o ckuusr.o ckucns
.o \
ckudia.o ckuscr.o ckcnet.o ckusig
.o \
ckctel.o ckcuni.o ckupty.o ckcftp
.o \
ckuath.o ck_crp.o ck_ssl.o -lncur
ses -lutil -lresolv -lcrypt  -lm
ckcpro.o: in function `wart':
ckcpro.c:(.text+0x8798): relocation trunc
ated to fit: R_AARCH64_LDST64_ABS_LO12_NC
against symbol `dest' defined in .bss se
ction in ckcmai.o
/usr/bin/ld: ckcpro.c:(.text+0x8798): war
ning: one possible cause of this error is
that the symbol is being referenced in t
he indicated code as if it had a larger a
lignment than was declared where it was d
efined
collect2: error: ld returned 1 exit statu
s
make[2]: *** [makefile:1280: xermit] Erro
r 1
make[2]: Leaving directory '/home/default
user/ckermit'
make[1]: *** [makefile:6054: linuxa] Erro
r 2
make[1]: Leaving directory '/home/default
user/ckermit'
make: *** [makefile:6091: linux] Error 2

Not sure how to attach files here. I can upload ckcpro.c file if helpful...

Thanks
Last edited on
> I can upload ckcpro.c file if helpful...
It would be better to post the url of the repo where you got the whole source code from.

In the meantime, what do you get when you run these commands?
$ file foo.o
foo.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
$ size foo.o
   text	   data	    bss	    dec	    hex	filename
   2454	      0	      6	   2460	    99c	foo.o
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs 
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- 
--enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie 
--with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto 
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa 
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) 

Particularly ckcmai.o and ckcpro.o
Sounds like a 32bit problem. What's your architecture?

If it is, I have more to add.
@salem c -

Command outputs:
1
2
3
4
5
6
7
8
9
10
. file ckcmai.o
ckcmai.o: empty
[defaultuser@XperiaXZ2Compact ckermit]$ file ckcpro.o
ckcpro.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
[defaultuser@XperiaXZ2Compact ckermit]$ size ckcpro.o
text    data     bss     dec     hex filename
60639    1672    4224   66535   103e7 ckcpro.o
[defaultuser@XperiaXZ2Compact ckermit]$ size ckcmai.o
[defaultuser@XperiaXZ2Compact ckermit]$
  

Source is here https://github.com/bsdimp/ckermit or here http://www.columbia.edu/kermit/ck80.html#source (cku_211.tar.gz)


Last edited on
GCC v:
-v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch6
4-meego-linux-gnu/8.3.0/lto-wrapper
Target: aarch64-meego-linux-gnu
Configured with: ../configure --prefix=/usr
--mandir=/usr/share/man --disable-bootstra
p --with-bugurl=https://git.sailfishos.org/
--build=aarch64-meego-linux-gnu --with-isl
=/home/abuild/rpmbuild/BUILD/gcc-arm-src-sn
apshot-8.3-2019.03/obj-aarch64-meego-linux-
gnu/isl-install --enable-plugin --enable-in
itfini-array --with-arch=armv8-a --disable-
sjlj-exceptions --enable-gold --with-plugin
-ld=gold --libdir=/usr/lib64 --disable-mult
ilib --enable-checking=release --disable-fi
xed-point --with-system-zlib --enable-__cxa
_atexit --disable-libunwind-exceptions --en
able-gnu-unique-object --enable-lto --enabl
e-linker-build-id --disable-libmpx --enable
-languages=c,c++,lto --enable-threads=posix
--enable-shared --disable-libgcj --disable
-libcilkrts --enable-gnu-indirect-function
--build=aarch64-meego-linux-gnu
Thread model: posix
gcc version 8.3.0 20190222 (Sailfish OS gcc
8.3.0-4) (Linaro GCC 8.2-2018.08~dev)
Any ideas?
Well, you didn't answer my question. You haven't shown what you're doing. I can't reproduce your error from the info in this thread.

So, if you want help, the please help us to help you by providing some information on what you're doing.
I thought your question was "what is your architecture", to which I replied "aarch64".

Did you have another question?
Sorry- I just noticed that my replay was not posted. I apologize... I don't know what happened. I know I wrote a reply, but not sure why it didn't post - maybe I lost connection and didn't realize it.
It would also help if you showed what you run and how (parameters for example).
Just following readme: clone/download, cd, and run "make linux"...
I downloaded it, but it won't even compile on x86_64 (Ubuntu 20.04)
$ make linux
grep: /usr/include/sys/*.h: No such file or directory
make[1]: Entering directory '/home/work/code/ckermit'
Making C-Kermit "9.0.302" for Linux 1.2 or later...
IMPORTANT: Read the comments in the linux section of the
makefile if you have trouble.
make xermit KTARGET=${KTARGET:-linuxa} "CC = gcc" "CC2 = gcc" \
"CFLAGS = -O -DLINUX -pipe -funsigned-char -DFNFLOAT -DCK_POSIX_SIG \
-DCK_NEWTERM -DTCPSOCKET -DLINUXFSSTND -DNOCOTFMC -DPOSIX \
-DUSE_STRERROR -DHAVE_PTMX   -DHAVE_OPENPTY -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CRYPT_H " "LNKFLAGS = " \
"LIBS = -lutil -lresolv -lcrypt  -lm"
make[2]: Entering directory '/home/work/code/ckermit'
gcc -O -DLINUX -pipe -funsigned-char -DFNFLOAT -DCK_POSIX_SIG -DCK_NEWTERM -DTCPSOCKET -DLINUXFSSTND -DNOCOTFMC -DPOSIX -DUSE_STRERROR -DHAVE_PTMX   -DHAVE_OPENPTY -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CRYPT_H  -DKTARGET=\"linux\" -c ckucmd.c
In file included from ckucmd.c:41:
ckucmd.c: In function ‘cmdconchk’:
ckucmd.c:7385:48: error: ‘FILE’ {aka ‘struct _IO_FILE’} has no member named ‘_cnt’
 7385 |     debug(F101,"cmdconchk stdin->_cnt","",stdin->_cnt);
      |                                                ^~
ckcdeb.h:5129:51: note: in definition of macro ‘debug’
 5129 | ((void)(deblog?dodebug(a,b,(char *)(c),(CK_OFF_T)(d)):0))
      |                                                   ^
ckucmd.c:7386:14: error: ‘FILE’ {aka ‘struct _IO_FILE’} has no member named ‘_cnt’
 7386 |     x = stdin->_cnt;
      |              ^~
make[2]: *** [makefile:985: ckucmd.o] Error 1
make[2]: Leaving directory '/home/work/code/ckermit'
make[1]: *** [makefile:6054: linuxa] Error 2
make[1]: Leaving directory '/home/work/code/ckermit'
make: *** [makefile:6091: linux] Error 2
I fixed that error with a patch. I don't remember where I got it, but it's for ckucmd.c file. The patch is:

--- ./ckucmd.c.orig 2019-09-11 12:36:53.268603997 -0700
+++ ./ckucmd.c 2019-09-11 12:54:44.334194091 -0700
@@ -7103,7 +7103,7 @@

/* Here we must look inside the stdin buffer - highly platform dependent */

-#ifdef _IO_file_flags /* Linux */
+#ifdef __FILE_defined /* Linux */
x = (int) ((stdin->_IO_read_end) - (stdin->_IO_read_ptr));
debug(F101,"cmdconchk _IO_file_flags","",x);
#else /* _IO_file_flags */


Then the other error comes
OK, got it to compile with the patch.

Now some thoughts.
> ckcpro.o: in function `wart':

Looking at the source code, I see several interesting things.
1. It's auto generated.
1
2
3
/* WARNING -- This C source program generated by Wart preprocessor. */
/* Do not edit this file; edit the Wart-format source file instead, */
/* and then run it through Wart to produce a new C source file.     */


2. It's caused trouble before.
1
2
3
4
5
6
7
8
9
/*
  By late 1999, the big switch() statement generated from the following state
  table began choking even gcc, so here we extract the code from the larger
  states into static routines to reduce the size of the cases and the
  switch() overall.  The routines follow the state table; the prototypes are
  here.  Each of these routines simply contains the text from the
  corresponding case, but with return(-1) added in appropriate places; see
  instructions after the state table switcher.
*/


3. It's a huge function, 1800 lines long.
Maybe it needs more factoring of code into other functions.

4. The 'dest' variable it barfs on is only used once, and that's in a conditional.
1
2
3
4
#ifdef CALIBRATE
    if (dest == DEST_N)
      calibrate = 1;
#endif /* CALIBRATE */ 

Although it says it's auto-generated, you could try just editing it to remove those few lines and typing 'make linux' again.
Thank you.
Here's new output, seems like same error in 'skipbup', plus a few undefined refs...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
➜  make linux
make[1]: Entering directory '/home/defaul
tuser/ck'
Making C-Kermit "8.0.211" for Linux 1.2 o
r later...
IMPORTANT: Read the comments in the linux
section of the
makefile if you have trouble.
make xermit KTARGET=${KTARGET:-linuxa} "C
C = gcc" "CC2 = gcc" \
"CFLAGS = -O -DLINUX -pipe -funsigned-cha
r -DFNFLOAT -DCK_POSIX_SIG \
-DCK_NEWTERM -DTCPSOCKET -DLINUXFSSTND -D
NOCOTFMC -DPOSIX \
-DUSE_STRERROR -DCK_NCURSES -I/usr/includ
e/ncurses -DHAVE_PTMX  -DHAVE_CRYPT_H " "
LNKFLAGS = " "LIBS = -lncurses   -lm"
make[2]: Entering directory '/home/defaul
tuser/ck'
gcc  -o wermit \
ckcmai.o ckclib.o ckutio.o ckufio
.o \
ckcfns.o ckcfn2.o ckcfn3.o ckuxla
.o \
ckcpro.o ckucmd.o ckuus2.o ckuus3
.o \
ckuus4.o ckuus5.o ckuus6.o ckuus7
.o \
ckuusx.o ckuusy.o ckuusr.o ckucns
.o \
ckudia.o ckuscr.o ckcnet.o ckusig
.o \
ckctel.o ckcuni.o ckupty.o ckcftp
.o \
ckuath.o ck_crp.o ck_ssl.o -lncur
ses   -lm
/usr/bin/ld: ckufio.o: in function `zvpas
s':
ckufio.c:(.text+0xd574): undefined refere
nce to `crypt'
ckuusx.o: in function `ftreset':
ckuusx.c:(.text+0x2568): relocation trunc
ated to fit: R_AARCH64_LDST64_ABS_LO12_NC
against symbol `skipbup' defined in .bss
section in ckcmai.o
/usr/bin/ld: ckuusx.c:(.text+0x2568): war
ning: one possible cause of this error is
that the symbol is being referenced in t
he indicated code as if it had a larger a
lignment than was declared where it was d
efined
/usr/bin/ld: ckcnet.o: in function `locat
e_srv_dns':
ckcnet.c:(.text+0x45c4): undefined refere
nce to `__res_search'
/usr/bin/ld: ckcnet.c:(.text+0x4610): und
efined reference to `__dn_expand'
/usr/bin/ld: ckcnet.c:(.text+0x46b4): und
efined reference to `__dn_expand'
/usr/bin/ld: ckcnet.c:(.text+0x4770): und
efined reference to `__dn_expand'
/usr/bin/ld: ckcnet.o: in function `locat
e_txt_rr':
ckcnet.c:(.text+0xb1c8): undefined refere
nce to `__res_search'
/usr/bin/ld: ckcnet.c:(.text+0xb214): und
efined reference to `__dn_expand'
/usr/bin/ld: ckcnet.c:(.text+0xb34c): und
efined reference to `__dn_expand'
collect2: error: ld returned 1 exit statu
s
make[2]: *** [makefile:1202: xermit] Erro
r 1
make[2]: Leaving directory '/home/default
user/ck'
make[1]: *** [makefile:5448: linuxa] Erro
r 2
make[1]: Leaving directory '/home/default
user/ck'
make: *** [makefile:5473: linux] Error 2 
I wonder of the issue is with my GCC... I'll mess around more. Thanks
Topic archived. No new replies allowed.