Here is a less messy version of the error message:
BuildReallySmall
compiling reallysmalllib
creating shared lib for reallysmalllib
compiling executable
linking in executable
/usr/bin/ld: reallysmall: hidden symbol `stat64' in
/usr/lib64/libc_nonshared.a(stat64.oS) is referenced by DSO
collect2: ld returned 1 exit status
The linker I'm using is:
ld --version
GNU ld version 2.17.50.0.6-2.el5 20061020
Any assistance would be greatly appreciated.
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int shareme()
{
int fstat_result;
struct stat fstat_buf;
fstat_result=stat("/rv/home/ghughesf/GarysTools.cpio",&fstat_buf);
printf ("Hello World\n");
return (0);
}
# First, clean
rm *.o *.a *.so *.lib *map.txt> /dev/null 2>&1
echo compiling reallysmalllib
c++ -Wall -Woverloaded-virtual -g -c reallysmalllib.cpp \
-o reallysmalllib.o -fPIC -D_FILE_OFFSET_BITS=64
echo creating shared lib for reallysmalllib
ld -shared -soname reallysmalllib.so -o reallysmalllib.so \
reallysmalllib.o
echo compiling executable
c++ -Wall -Woverloaded-virtual -g -c reallysmall.cpp \
-o reallysmall.o -fPIC -D_FILE_OFFSET_BITS=64
echo linking in executable
c++ -Wall -Woverloaded-virtual -g reallysmall.o \
reallysmalllib.so -o reallysmall -fPIC
extern int shareme();
int
main()
{
(void) shareme();
return (0);
}