I am getting this set of gcc errors, and I can't seem to get an answer from google or the man pages. Any insight on what these mean or where to start looking?
Here is the line in the makefile:
#After building several otehr bits of code into static libraries
...
# Grand finally link all the object files into one
gcc --shared \
-m64 \
-Wl,--whole-archive ./release64/*.a \
-o ./release64/libMYLIB.so.1.0
ln -sf libArcGIS.so.1.0 ./release64/libMYLIB.so
ln -sf libArcGIS.so.1.0 ./release64/libMYLIB.so.1
I get the following errors (there are many more I took the top n just to give an idea:
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_muldi3.o): In function `__multi3':
(.text+0x0): multiple definition of `__multi3'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_muldi3.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_negdi2.o): In function `__negti2':
(.text+0x0): multiple definition of `__negti2'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_negdi2.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_lshrdi3.o): In function `__lshrti3':
(.text+0x0): multiple definition of `__lshrti3'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_lshrdi3.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_ashldi3.o): In function `__ashlti3':
(.text+0x0): multiple definition of `__ashlti3'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_ashldi3.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_ashrdi3.o): In function `__ashrti3':
(.text+0x0): multiple definition of `__ashrti3'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_ashrdi3.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_cmpdi2.o): In function `__cmpti2':
(.text+0x0): multiple definition of `__cmpti2'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_cmpdi2.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_ucmpdi2.o): In function `__ucmpti2':
(.text+0x0): multiple definition of `__ucmpti2'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_ucmpdi2.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_clear_cache.o): In function `__clear_cache':
(.text+0x0): multiple definition of `__clear_cache'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_clear_cache.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_enable_execute_stack.o): In function `__enable_execute_stack':
(.text+0x0): multiple definition of `__enable_execute_stack'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_enable_execute_stack.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_absvsi2.o): In function `__absvsi2':
(.text+0x0): multiple definition of `__absvsi2'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_absvsi2.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_absvsi2.o): In function `__absvdi2':
(.text+0x20): multiple definition of `__absvdi2'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_absvsi2.o):(.text+0x20): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_absvdi2.o): In function `__absvti2':
(.text+0x0): multiple definition of `__absvti2'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_absvdi2.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_addvsi3.o): In function `__addvsi3':
(.text+0x0): multiple definition of `__addvsi3'
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_addvsi3.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgcc.a(_addvsi3.o): In function `__addvdi3':
Update
The static libraries I am trying to combine are:
-rw-rw-r-- 1 mehoggan mehoggan 487770 Jan 3 11:17 libfreetype.a
-rw-rw-r-- 1 mehoggan mehoggan 227814 Jan 3 11:17 libjpeg.a
-rw-rw-r-- 1 mehoggan mehoggan 258576 Jan 3 11:17 libpng.a
-rw-rw-r-- 1 mehoggan mehoggan 2392136 Jan 3 11:17 libSkia.a
-rw-rw-r-- 1 mehoggan mehoggan 696756 Jan 3 11:17 libSQlite.a
-rw-rw-r-- 1 mehoggan mehoggan 1517832 Jan 3 11:16 libSymbolXLib.a
-rw-rw-r-- 1 mehoggan mehoggan 928934 Jan 3 11:17 libxml2.a
I performed seperate compilation on each of the files so no linking was performed. I looked through the source and I don't see anything that involves libgcc. This is why the error makes not since to me.
To create a dynamic library in Linux, simply type the following command: gcc *. c -c -fPIC and hit return. This command essentially generates one object file .o for each source file .
The way to create a Dynamic Library in Linux is with the gcc command using the -c to generate the object files (.o) from the source files (. c) and the -fPIC to make the code position independent. Thus, the following command makes a bunch of .o files from each .
In C exist two kinds of libraries the first ones are the static that allows us to link to the program and are not relevant during the runtime, and the other ones are called dynamic libraries those are preferable use when you run a lot of programs at the same time who are using the same library and you want to be more ...
You are missing a closing --no-whole-archive
. That is
gcc --shared \
-m64 \
-Wl,--whole-archive ./release64/*.a -Wl,--no-whole-archive \
-o ./release64/libMYLIB.so.1.0
ln -sf libArcGIS.so.1.0 ./release64/libMYLIB.so
ln -sf libArcGIS.so.1.0 ./release64/libMYLIB.so.1
Without the closing --no-whole-archive
, the initial --whole-archive
will affect all the libraries passed on to the linker, libgcc in particular which is always passed on implicitly. That's why you are getting duplicate symbols.
It means just what it says. There are two or more .a files that contain .o files that contain definitions of these functions. In particular, it looks as if your directory contains either two variations on libgcc.a or a something containing a copy of it.
Don't do this to libgcc.a at all. To omit libgcc add -nostdlib or even -nodefaultlibs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With