From tadakado at gmail.com  Thu Jul  3 02:50:11 2008
From: tadakado at gmail.com (Tadashi Kadowaki)
Date: Thu, 3 Jul 2008 09:50:11 +0900
Subject: [Rd] Autoconf / Windows package building problem for device
	package
In-Reply-To: <F2312D54-A8E5-45A3-96B9-A82FF1F671D8@r-project.org>
References: <W1956210678187551214920636@nocme1bl6.telenet-ops.be>
	<BA263532-73BC-434C-90C1-8B6164331C3B@r-project.org>
	<dcb3073c0807020341u67fadcddgf12f49b7fa0e5312@mail.gmail.com>
	<F2312D54-A8E5-45A3-96B9-A82FF1F671D8@r-project.org>
Message-ID: <dcb3073c0807021750yf92781dm9ea2755b7b5095ee@mail.gmail.com>

Simon,

>> Now, pdf2 does not use "manually created config.h",
>
> I was referring to R - there is no configure step in the Windows build so
> config.h is created "manually" (or semi-automatically if you wish) and then
> shipped with R in a special location.

I misunderstand what you meant. I found src/gnuwin32/fixed/h/config.h in
source distribution of R. Thank you for that. It would be useful for building
pdf2 package in Windows.

>> but create own config.h by itself.
>> The package also does not refer internal headers installed with R.
>
> There are no internal header files installed with R ;) [modulo OS X and
> those are private] - you are simply copying them from R and referring to
> those. This is very tedious and difficult to do right for all platforms
> since you have to test them all (as you see ;)). However you don't really
> need to do that.
>
>
>>  However, the package needs internal headers, because original pdf device
>> code needs them.
>
> Your package contains way too many things that are not needed (and are
> dangerous because they override R's own functions unnecessarily).

If you say the package is dangerous because of overriding R's own functions
unnecessarily, it is not correct. I carefully choose functions to be overridden.
Following functions are minimals for adding new features of pdf device.

 > library(pdf2)
 Attaching package: 'pdf2'
	The following object(s) are masked from package:graphics :
	 mtext,
	 rect,
	 text
	The following object(s) are masked from package:grDevices :
	 pdf,
	 pdf.options,
	 pdfFonts

> It would
> be much simpler if you just added the code that is necessary (both R and C)
> and not just copy everything blindly. There is no real need to use internal
> R headers from graphics devices. If I recall correctly that is what Brian
> Ripley suggested before and it would save you a lot of trouble.

For writing a proper package of R, you are completely correct.
However, I don't want to pay efforts for simplifying the code.
I think the pdf2 package is designed for proof of the concept of
adding pdf specific features, such as pop-up text and url link.
Therefore, I want to keep devPS.c of the pdf2 replaceable with that of R.
This is also better for following the edge of R development.

Regards,
Tadashi Kadowaki

>
> Cheers,
> Simon
>
>
>>
>> Therefore, It has local copies of the headers.
>> Your suggestion is quite proper, and this is still bad implementation.
>> But, to catch up the development of pdf device in the R core, my approach
>> is pragmatic. I'll release version-specific packages by using internal
>> headers of each R versions. If the package checks R version strictly, this
>> approach should be not so dangerous, because almost all code of pdf2 is from
>> original pdf device code.
>> (I know I have to use pdf device code and headers from R 2.7.1 now)
>>
>> Regards,
>> Tadashi Kadowaki
>>
>> 2008/7/2 Simon Urbanek <simon.urbanek at r-project.org>:
>>>
>>> Tobias,
>>>
>>> that package uses headers internal to R (a really bad thing to do).
>>> Although
>>> it attempts to supply them (very dangerous again since they are
>>> R-version-dependent) they rely on configured R sources which are not
>>> present
>>> on Windows. I don't have a Windows machine handy, but I dimly remember
>>> that
>>> you can find manually created config.h for Windows in fixed-h directory
>>> under gnuwin32. It's a hack (and I'm not sure if it helps), though, so
>>> I'd
>>> strongly suggest Tadashi to fix his package to use official API as was
>>> suggested a few times already.
>>>
>>> Cheers,
>>> Simon
>>>
>>>
>>> On Jul 1, 2008, at 9:57 AM, Tobias Verbeke wrote:
>>>
>>>> Dear list,
>>>>
>>>> Tadashi Kadowaki has developed a pdf device package
>>>> that allows to add hyperlinks and popups
>>>> to (currently) text, mtext and rect calls.
>>>>
>>>> The package passes R CMD check (minor warnings) and compiles
>>>> on MacOS X and GNU/Linux, but we do not succeed in building
>>>> the package for Windows.
>>>>
>>>> The current version of the package can be
>>>> checked out as
>>>>
>>>> svn checkout svn://svn.r-forge.r-project.org/svnroot/pdf2/trunk
>>>>
>>>> Please find the 00install.out below.
>>>>
>>>> Could anyone tell why config.h is not found?
>>>>
>>>> My practical experience with the GNU build
>>>> tools is very limited but I would have hoped
>>>> config.h.in would be processed into config.h.
>>>>
>>>> Any pointer or hint will be appreciated.
>>>>
>>>> Many thanks in advance,
>>>> Tobias
>>>>
>>>> P.S. 00install.out (using R 2.7.1 and a current Rtools28.exe):
>>>>
>>>>
>>>>
>>>> installing R.css in C:/DOCUME~1/tverbeke/WORKSP~2/pdf2/TRUNK~1.RCH
>>>>
>>>>
>>>> ---------- Making package trunk ------------
>>>>
>>>> **********************************************
>>>> WARNING: this package has a configure script
>>>>      It probably needs manual configuration
>>>> **********************************************
>>>>
>>>> adding build stamp to DESCRIPTION
>>>> installing NAMESPACE file and metadata
>>>> making DLL ...
>>>> gcc  -std=gnu99  -Ic:/R/R-2.7.0/include   -Iinclude -DHAVE_CONFIG_H  -O3
>>>> -Wall  -c devPS.c -o devPS.o
>>>> devPS.c:26:20: error: config.h: No such file or directory
>>>> In file included from devPS.c:29:
>>>> include/Defn.h:1022: error: expected '=', ',', ';', 'asm' or
>>>> '__attribute__' before 'Rf_onsigusr1'
>>>> include/Defn.h:1023: error: expected '=', ',', ';', 'asm' or
>>>> '__attribute__' before 'Rf_onsigusr2'
>>>> In file included from
>>>>
>>>> c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1-sjlj/../../../../include/wchar.h:352,
>>>>              from include/Defn.h:1126,
>>>>              from devPS.c:29:
>>>>
>>>>
>>>> c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1-sjlj/../../../../include/stdint.h:66:
>>>> error: conflicting types for 'intptr_t'
>>>> include/Defn.h:204: error: previous declaration of 'intptr_t' was here
>>>>
>>>>
>>>> c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1-sjlj/../../../../include/stdint.h:75:
>>>> error: conflicting types for 'uintptr_t'
>>>> include/Defn.h:207: error: previous declaration of 'uintptr_t' was here
>>>> devPS.c: In function 'pathcmp':
>>>> devPS.c:449: error: 'FILESEP' undeclared (first use in this function)
>>>> devPS.c:449: error: (Each undeclared identifier is reported only once
>>>> devPS.c:449: error: for each function it appears in.)
>>>> devPS.c: In function 'LoadEncoding':
>>>> devPS.c:515: error: 'FILESEP' undeclared (first use in this function)
>>>> devPS.c: In function 'PostScriptLoadFontMetrics':
>>>> devPS.c:560: error: 'FILESEP' undeclared (first use in this function)
>>>> devPS.c: In function 'PostScriptMetricInfo':
>>>> devPS.c:862: warning: implicit declaration of function 'Riconv_open'
>>>> devPS.c:862: warning: assignment makes pointer from integer without a
>>>> cast
>>>> devPS.c:872: warning: implicit declaration of function 'Riconv'
>>>> devPS.c:874: warning: implicit declaration of function 'Riconv_close'
>>>> devPS.c: In function 'mbcsToSbcs':
>>>> devPS.c:4020: warning: assignment makes pointer from integer without a
>>>> cast
>>>> devPS.c:4029: error: 'EILSEQ' undeclared (first use in this function)
>>>> devPS.c: In function 'PDF_NewPage':
>>>> devPS.c:6406: warning: unused variable 'i'
>>>> devPS.c: In function 'PDF_StrSize':
>>>> devPS.c:7129: warning: unused variable 'face'
>>>> devPS.c:7128: warning: unused variable 'pd'
>>>> devPS.c: In function 'PDFAnnotBox':
>>>> devPS.c:7469: warning: passing argument 5 of 'Rf_GConvert' from
>>>> incompatible pointer type
>>>> devPS.c:7470: warning: passing argument 5 of 'Rf_GConvert' from
>>>> incompatible pointer type
>>>> make[3]: *** [devPS.o] Error 1
>>>> make[2]: *** [srcDynlib] Error 2
>>>> make[1]: *** [all] Error 2
>>>> make: *** [pkg-trunk] Error 2
>>>> *** Installation of trunk failed ***
>>>>
>>>> Removing 'C:/DOCUME~1/tverbeke/WORKSP~2/pdf2/TRUNK~1.RCH/trunk'
>>>>
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>
>>>>
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>
>>
>>
>> --
>> ?????
>> tadakado at gmail.com
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
>



[Rd] Autoconf / Windows package building problem for device package
Tadashi Kadowaki