Right, cracked it. For those who maybe interested the problem was with
the version or build of GNU ld shipped with Fedora Core 2 and RH 9
(others maybe too but I personally havn't tested them!). When trying to
create the shared library using LD it fails with the error I wrote to
Wei Dai about in the previous post.
However passing ld options to g++ to create the shared library works
fine. For reference I have included my rather crude, but working,
Makefile for building crypto++ 5.2 on Fedora Core 2 (intel).
Thanks to Wei Dai for fixing the original bug and supplying a patch so
early.
Regards
James Vanns
On Mon, 2004-07-05 at 13:05, James Vanns wrote:
> On Mon, 2004-07-05 at 12:27, Wei Dai wrote:
> > Does this page help?
> > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=101048
> >
> > A Google search on "hidden symbol __dso_handle" doesn't turn up many
> > other useful entries.
>
> I know I tried! Unfortunately upgrading gcc-c++ and libstdc++ seems
> ridiculous because so many packages depend on the version installed. I
> upgraded binutils (which includes ld) to the version in their
> development branch under Fedora but this makes no difference.
>
> God damn RedHat! Thanks for your help though Wei Dai (sorry for spelling
> your name wrong in the last E-mail!). I'll keep searching....
>
> Regards
>
> Jim
>
> > On Mon, Jul 05, 2004 at 11:17:04AM +0100, James Vanns wrote:
> > > Thats great! Cheers Wei Dei - it worked fine. However, when trying to
> > > link against the resulting shared library I get this error from ld:
> > >
> > > /usr/bin/ld: cryptest: hidden symbol `__dso_handle' in
> > > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/crtbegin.o is referenced by DSO
> > >
> > > This includes the cryptest executable as well as bespoke code. Any
> > > ideas?
> > >
> > > Sorry!
> > >
> > > Jim
> > >
> > > On Sat, 2004-07-03 at 03:03, Wei Dai wrote:
> > > > Please try the attached patch.
> > > >
> > > > On Fri, Jul 02, 2004 at 12:35:20PM +0100, James Vanns wrote:
> > > > > All,
> > > > >
> > > > > When trying to compile integer.cpp with the following:
> > > > >
> > > > > g++ -pipe -msse2 -march=i386 -O1 -fPIC -c integer.cpp
> > > > >
> > > > > I get the error:
> > > > >
> > > > > integer.cpp: In function `void CryptoPP::CpuId(unsigned int, word32*)':
> > > > > integer.cpp:877: error: can't find a register in class `BREG' while
> > > > > reloading
> > > > > `asm'
> > > > >
> > > > > Now, I know it's because of fPIC but I'd like to try and build this as a
> > > > > shared library. Anyone know of any workarounds for this? The code g++ is
> > > > > complaining about is:
> > > > >
> > > > > __asm__
> > > > > (
> > > > > "cpuid"
> > > > > : "=a" (output[0]), "=b" (output[1]), "=c" (output[2]), "=d"
> > > > > (output[3])
> > > > > : "a" (input)
> > > > > );
> > > > >
> > > > > I'm afraid I know next to nothing about embedded/inline ASM!
> > > > >
> > > > > Cheers
> > > > >
> > > > > Jim Vanns
> > > > >
> > > > > --
> > > > > James Vanns BSc (Hons) MCP
> > > > > Senior Software Engineer (Linux / C & C++)
> > > > > Canterbury Christ Church University College
> > > > > Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370
> > > > >
> > > --
> > > James Vanns BSc (Hons) MCP
> > > Senior Software Engineer (Linux / C & C++)
> > > Canterbury Christ Church University College
> > > Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370
> > >
--
James Vanns BSc (Hons) MCP
Senior Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370
CXX = g++
LD = ld
LN = ln
CXXFLAGS = -pipe -msse2 -O2 -DNDEBUG
LDFLAGS = -shared -Wl,-soname,libcryptopp.so.5 -o libcryptopp.so.5.2
LNFLAGS = -s -f
SRCS = $(wildcard *.cpp)
ifeq ($(SRCS),)
SRCS = $(shell ls *.cpp)
endif
OBJS = $(SRCS:.cpp=.o)
TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o
regtest.o fipsalgt.o dlltest.o
LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))
all: cryptest
install: libcryptopp.so
install -o root -g root -m 0755 -v libcryptopp.so.5.2 /usr/lib
$(LN) $(LNFLAGS) /usr/lib/libcryptopp.so.5.2 /usr/lib/libcryptopp.so.5
$(LN) $(LNFLAGS) /usr/lib/libcryptopp.so.5 /usr/lib/libcryptopp.so
mkdir -p -m 0755 /usr/include/cryptopp-5.2
$(LN) $(LNFLAGS) /usr/include/cryptopp-5.2 /usr/include/cryptopp
install -o root -g root -m 0644 -v *.h /usr/include/cryptopp-5.2
clean:
$(RM) cryptest libcryptopp.so.5.2 $(LIBOBJS) $(TESTOBJS)
libcryptopp.so: $(LIBOBJS)
$(CXX) $(LDFLAGS) $(LIBOBJS) -lc
$(LN) $(LNFLAGS) libcryptopp.so.5.2 libcryptopp.so.5
$(LN) $(LNFLAGS) libcryptopp.so.5 libcryptopp.so
cryptest: libcryptopp.so $(TESTOBJS)
$(CXX) $(CXXFLAGS) -o $@ $(TESTOBJS) -L. -lcryptopp
adhoc.cpp: adhoc.cpp.proto
ifeq ($(wildcard adhoc.cpp),)
cp adhoc.cpp.proto adhoc.cpp
else
touch adhoc.cpp
endif
%.o : %.cpp
$(CXX) $(CXXFLAGS) -fPIC -c $<