We have a mixed bunch of 32-bit (i686) and 64-bit (x86_64) Fedora 11
machines. I created a library on one of the 32-bit machines by issuing
the commands
g++ -c List.cc
ar q libList.a List.o
ranlib libList.a
Suppose that I attempt to use same on a 64-bit machine:
g++ -o foo foo.o -L. -lList
I get the following:
/usr/bin/ld: skipping incompatible libList.a when searching for -lList
/usr/bin/ld: cannot find -lList
Now it's my impression that the 64-bit machines can use 32-bit
libraries, see (e.g.) /usr/lib vs. /usr/lib64. Other than the fact that
these two directories are using shared libraries (.so), is there
something I'm missing here that would allow the 32-bit libraries to be
used on the 64-bit machines?
Many thanks.
--
Art Werschulz (8-{)} "Metaphors be with you." -- bumper sticker
GCS/M (GAT): d? -p+ c++ l++ u+ P++ e--- m* s n+ h f g+ w+ t+ r-
Net: a...@dsm.fordham.edu http://www.dsm.fordham.edu/~agw
Phone: Fordham U. (212) 636-6325, Columbia U. (646) 775-6035
> We have a mixed bunch of 32-bit (i686) and 64-bit (x86_64) Fedora 11
> machines. I created a library on one of the 32-bit machines by issuing
> the commands
> g++ -c List.cc
> ar q libList.a List.o
> ranlib libList.a
>
> Suppose that I attempt to use same on a 64-bit machine:
> g++ -o foo foo.o -L. -lList
> I get the following:
> /usr/bin/ld: skipping incompatible libList.a when searching for -lList
> /usr/bin/ld: cannot find -lList
You just tried to link a 32-bit library into a 64-bit executable.
> Now it's my impression that the 64-bit machines can use 32-bit
> libraries, see (e.g.) /usr/lib vs. /usr/lib64. Other than the fact that
> these two directories are using shared libraries (.so), is there
> something I'm missing here that would allow the 32-bit libraries to be
> used on the 64-bit machines?
32-bit executables can use 32-bit libraries. 64-bit executables cannot
(for practical purposes) use 32-bit libraries.
What are you trying to do exactly? Are you trying to produce a 64-bit
executable using a 32-bit library? Or are you trying to produce a 32-
bit executable using a 32-bit library on a 64-bit machine?
DS
David Schwartz <dav...@webmaster.com> writes:
> 32-bit executables can use 32-bit libraries. 64-bit executables cannot
> (for practical purposes) use 32-bit libraries.
I wasn't aware of the latter.
> What are you trying to do exactly? Are you trying to produce a 64-bit
> executable using a 32-bit library? Or are you trying to produce a 32-
> bit executable using a 32-bit library on a 64-bit machine?
This put me on the right path. For those who are interested, I needed
to add the -m32 option to g++. The problem was then that I didn't have
the stubs-32.h file. A bit of searching led me to the glibc-devel.i586
package, which did the trick.
Thanks, David.
> Thanks, David.
You're welcome. By the way, you asked the wrong question. You should
have asked "how can I build a 32-bit binary on a 64-bit system".
DS
David Schwartz <dav...@webmaster.com> writes:
You're right. Of course,
do {
ask_question;
get_answer;
} while (! issue_clarified);
is a pretty useful general paradigm. :-)