M.T. Bayat
M.T. Bayat

Reputation: 47

"/usr/bin/ld: errno: TLS definition in /lib/libc.so.6" in compiling a fortran file

Getting this error when compile my program on ubuntu 32bit desktop system. I assume that perhaps can be library problem. can any one tell me right answer.........

Problem is...........

/usr/bin/ld: errno: TLS definition in /lib/i386-linux-gnu/libc.so.6 section .tbss mismatches non-TLS reference in /media/9C2C3AB22C3A8774/tez/Ahmadfiles/cern_mohammad/cern/pro/lib/libpacklib.a(remote.o)
/lib/i386-linux-gnu/libc.so.6: could not read symbols: Bad value
collect2: ld returned 1 exit status

makefile:

C = .c
F = .f
O = .o
output = geant_elastic_135
paw2root = h2root
datadisk = /home/bayat/

.SUFFIXES: $(C) $(F)

SRCS = draw_i$(F) scint_geo$(F) mwpc_geo$(F) gutrev$(F) \
gukine$(F) gustep$(F) material$(F) carb_del_geo$(F)\
uginit$(F) uglast$(F) pipe$(F) function$(F) \
ugeom$(F) guout$(F) ntuple$(F) target$(F)\
pbal_geo$(F) gcalor_unix$(F) guphad$(F)\
guhadr$(F)

OBJS = draw_i$(O) scint_geo$(O) mwpc_geo$(O) gutrev$(O)\
gukine$(O) gustep$(O) material$(O) carb_del_geo$(O)\
uginit$(O) uglast$(O) pipe$(O) function$(O) \
ugeom$(O) guout$(O) ntuple$(O) target$(O) \
pbal_geo$(O) gcalor_unix$(O) guphad$(O)\
guhadr$(O)



CERNLIB = -L/media/9C2C3AB22C3A8774/tez/Ahmadfiles/cern_mohammad/cern/pro/lib
CERNOPT = -L/media/9C2C3AB22C3A8774/tez/Ahmadfiles/cern_mohammad/cern/pro/lib

CERNINCL = -I/media/9C2C3AB22C3A8774/tez/Ahmadfiles/cern_mohammad/cern/pro/include

LIBS = -L/usr/X11R6/lib

LINKLIB = -lgeant321 -lkernlib -lpawlib -lgraflib -lgrafX11 -lX11 -lm \
-lpacklib -lmathlib -lphtools -lg2c -lcrypt -ldl -lnsl -llapack3 \
-lblas


FORTOPT = -x f77-cpp-input -Wall

.c.o:
gcc -c $(CERNINCL) $<

.f.o:
g77 -Wall -c $(FORTOPT) $(CERNOPT) $(CERNINCL) $<



default: $(OBJS)
g77 -Wall main.f -o gbat.exe $(OBJS) $(CERNLIB) $(LIBS) \
$(LINKLIB) $(LINKLIB)

i :$(OBJS)
g77 -Wall gxint321.f -o gint.exe $(OBJS) $(CERNLIB) $(LIBS) \
$(LINKLIB) $(LINKLIB)

t:
$(paw2root) $(output).hbook $(output).root
ls -sh $(output).*
mv $(output).* $(datadisk)
@echo "$(output) transfered to $(datadisk)"

clean:
rm *.o *~ gbat.exe gint.exe

and here is the main.f :

PROGRAM POLARIMETER
*
* Main program for polarimeter detector
*
* Declaration
IMPLICIT NONE
INTEGER NGBANK, NWPAWC, MAX_TIME
PARAMETER(NGBANK=60000000,NWPAWC=5000000, MAX_TIME=3000000)
REAL H(NGBANK), Q(NWPAWC)
REAL t
COMMON/GCBANK/H
COMMON/PAWC/Q
*
* Begining of the main program
CALL TIMEST(24.*3600.)
call timel(t)
print *,t
*
* initialize GEANT and HBOOK memory
CALL GZEBRA(NGBANK)
CALL HLIMIT(-NWPAWC)
*
* Open graphics system
* CALL HPLINT(0)
* CALL IGMETA(8,0)
* GEANT initialization
CALL UGINIT
* Event processing
CALL GRUN
* End of run
CALL UGLAST
END 

Upvotes: 2

Views: 6534

Answers (2)

Dave Hodgkinson
Dave Hodgkinson

Reputation: 375

You need to:

#include <errno.h>

Not have it as an extern int.

Upvotes: 7

user4490638
user4490638

Reputation:

You try to mix an old library (libpacklib.a) with a newer glibc. The glibc uses TLS (Thread Local Storage), and your library appears to use the older method.

You could try to downgrade your glibc to a version compiled without TLS, or update your library to a newer version (compiling it yourself, if you have the source). The first option is quite risky, unless you install an old system as a virtual machine or link against a special version of glibc for your program.

Upvotes: 1

Related Questions