Operating System - HP-UX
1748122 Members
3111 Online
108758 Solutions
New Discussion юеВ

gcc with libgdbm - can't compile

 
Andrew Lee_5
Occasional Advisor

gcc with libgdbm - can't compile

I want to compile a cpp program with g++ which needs the gdbm library. When I compile, error comes out:

g++ -g -c prog_a.cpp (this line is fine)
g++ -g -c prog_b.cpp (this line is fine too)
g++ -g -o prog prog_a.o prog_b.o /usr/local/lib/libgdbm.so (error with this line)

ld: Mismatched machine types. Expected EM_PARISC but found EM_IA_64 in file /usr/local/lib/libgdbm.so

The machine is running HP-UX 11i on RP8400 hardware.
I'd installed "gcc 3.0.2 for 64-bit 11.0 and 11i PA (binary)" and "gdbm for 11i Version 1.5 (binary)".
I'd tried to download "gdbm for 11i Version 1.5 (source)" to build the binary myself. but after building success, I can't find libgdbm.so in /usr/local/lib. But I can see a libgdbm.a file inside.

Had I done anything wrong? How to correct?
Any help would be appreciated. Thanks!

Andrew Lee
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: gcc with libgdbm - can't compile

You are trying to mix binary code for a PA-RISC procession and an Itanium processor. It's as if you were trying to link an executable using a Windows object file and an Apple library. That dog won't hunt. You need to find the PA-RISC version of the library.
If it ain't broke, I can fix that.
Martin Johnson
Honored Contributor

Re: gcc with libgdbm - can't compile

You have the wrong version of the library. You need to install the correct version of the library.

HTH
Marty
Andrew Lee_5
Occasional Advisor

Re: gcc with libgdbm - can't compile

Thanks guys.

One more question:

This is where I download the library:
http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,549,00.html

I found these 2 versions, which one is for RISC? (I am using the first one)
1. gdbm for 11i Version 1.5 (binary)
2. gdbm for 11.0 and 11i (binary)

BTW, will it be my gcc problem? I'd installed 64-bit version. Will it conflicts with RISC?

Thanks for helping me.

Andrew Lee

A. Clay Stephenson
Acclaimed Contributor

Re: gcc with libgdbm - can't compile

You need the 11.0 and 11i (which is really 11.11) version BUT you may still have problems. The 64-bit 11.11 OS will run either 32-bit or 64-bit PA-RISC code but you cannot mix and match binaries. If the library contains 32-bit code then you must set your compiler flags to generate 32-bit code as well; the converse is true as well. Both the library and your application must both zig or they must both zag; zig-zag's (code mismatches) are a no-no.
If it ain't broke, I can fix that.
Andrew Lee_5
Occasional Advisor

Re: gcc with libgdbm - can't compile

Thanks for the prompt reply.
As I am a newbie to C++ and HP-UX, I want to make sure one point:
Is the "gdbm for 11.0 and 11i (binary)" in 32-bit code? If yes, how to set the compiler flags to generate 32-bit code?
Any reference document? Thanks.

Andrew Lee