Antonio, Fabio Di Narzo
2005-Sep-02 15:57 UTC
[R] source package linking problem under linux
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'... Antonio, Fabio Di Narzo.> version_ platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major 2 minor 1.1 year 2005 month 06 day 20 language R
"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. Now *why* that happens is a bit hard to figure out. Your version info below is not quite sufficient; which linux distribution is it? Did you compile R itself from sources? Antonio, Fabio Di Narzo.> > > > version > _ > platform i386-pc-linux-gnu > arch i386 > os linux-gnu > system i386, linux-gnu > status > major 2 > minor 1.1 > year 2005 > month 06 > day 20 > language R > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907