faheem@email.unc.edu
2003-Mar-16 19:48 UTC
[Rd] R CMD SHLIB uses foo.c instead of foo.cc if both are present (PR#2644)
Full_Name: Faheem Mitha Version: 1.6.2 OS: Debian GNU/Linux Submission from: (NULL) (209.42.199.193) Suppose you are making a shared library using R CMD SHLIB foo.cc If there is a file called foo.c in the same directory, then it will be used instead. faheem ~/scratch/r-base>R CMD SHLIB foo.cc gcc-3.0 -I/usr/lib/R/include -D__NO_MATH_INLINES -mieee-fp -fPIC -g -O2 -c foo.c -o foo.o g++-3.0 -shared -o foo.so foo.o -L/usr/lib/R/bin -lR This has been rather annoying for me, because I sometimes write C and C++ versions of the same program side by side and so the files have the same name except for the extensions. It should be possible to fix it, though I don't understand the relevant scripts enough to suggest a patch. Note this bug has also been reported by me as Debian bug #184969. You can access this report via the web at http://bugs.debian.org/cgi-bin/bugreport.cgi?archive=no&bug=184969 Faheem.
Duncan Temple Lang
2003-Mar-16 20:10 UTC
[Rd] R CMD SHLIB uses foo.c instead of foo.cc if both are present (PR#2644)
The "fix" is relatively simple. One can change the order of the suffixes listed in $R_HOME/etc/Makeconf (i.e. the Makeconf.in version) to alter the precedence. If one changes the line .SUFFIXES: .c .cc .cpp .C .d .f .lo .o to place the '.c' after the '.cc', your example will work as you want it. While the behavior is not desirable since you specified foo.cc on the command line for R CMD SHLIB, I don't think it is a good idea to be using files named x.c and x.cc in the same directory. I would think that this will lead to confusions with other tools and I can't think of a context in which it is necessary. D. faheem@email.unc.edu wrote:> Full_Name: Faheem Mitha > Version: 1.6.2 > OS: Debian GNU/Linux > Submission from: (NULL) (209.42.199.193) > > > Suppose you are making a shared library using > > R CMD SHLIB foo.cc > > If there is a file called foo.c in the same directory, then it will be used > instead. > > faheem ~/scratch/r-base>R CMD SHLIB foo.cc > gcc-3.0 -I/usr/lib/R/include -D__NO_MATH_INLINES -mieee-fp -fPIC -g -O2 > -c foo.c -o foo.o > g++-3.0 -shared -o foo.so foo.o -L/usr/lib/R/bin -lR > > This has been rather annoying for me, because I sometimes write C and C++ > versions of the same program side by side and so the files have the same > name except for the extensions. It should be possible to fix it, though I > don't understand the relevant scripts enough to suggest a patch. > > Note this bug has also been reported by me as Debian bug #184969. You can access > > this report via the web at > http://bugs.debian.org/cgi-bin/bugreport.cgi?archive=no&bug=184969 > > Faheem. > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel-- _______________________________________________________________ Duncan Temple Lang duncan@research.bell-labs.com Bell Labs, Lucent Technologies office: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax: (908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan
Reasonably Related Threads
- R CMD SHLIB uses foo.c instead of foo.cc if both are present (PR#2645)
- R CMD SHLIB uses foo.c instead of foo.cc if both are present (PR#2648)
- passing arguments to R CMD SHLIB
- choosing g/g++ compiler executable in R CMD SHLIB
- using MAKEFLAGS in compiling C code as a shared library using R CMD SHLIB