"Antonio, Fabio Di Narzo" <antonio.fabio at gmail.com> writes:
I'm having some problems in installing some source packages under linux.
As an example, MCMCpack. An error is raised when linking:
install.packages("MCMCpack")
[...]
* Installing *source* package 'MCMCpack' ...
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking for trunc... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/lib/R/include -DSCYTHE_COMPILE_DIRECT -DSCYTHE_NO_RANGE
-c distributions.cc -o distributions.o
[...etc. etc. All compilations are ok]
g++ -o MCMCpack.so distributions.o ide.o la.o lecuyer.o MCMCdistn.o
MCMCdynamicEI.o MCMCfactanal.o MCMCfcds.o MCMChierEI.o MCMCirt1d.o
MCMClogit.o MCMCmetrop1R.o MCMCmixfactanal.o MCMCmnlMH.o
MCMCmnlslice.o MCMCoprobit.o MCMCordfactanal.o MCMCpanel.o
MCMCpoisson.o MCMCprobit.o MCMCprobitres.o MCMCregress.o MCMCrng.o
MCMCtobit.o mersenne.o optimize.o rng.o smath.o stat.o
-L/usr/lib/R/lib -lR
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../crt1.o(.text+0x18): In
function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [MCMCpack.so] Error 1
ERROR: compilation failed for package 'MCMCpack'
I don't know why it searches a reference to 'main'...
Presumably because it thinks that MCMCpack.so is supposed to be a
standalone binary. (Compilers don't read filname suffixes...)
There would seem to be something missing in that command line,
"-shared" if my memory serves me.