From khansen at stat.Berkeley.EDU  Fri Feb  9 18:11:36 2007
From: khansen at stat.Berkeley.EDU (Kasper Daniel Hansen)
Date: Fri, 9 Feb 2007 09:11:36 -0800
Subject: [Rd] Problem using ofstream in C++ class in package for MacOS X
In-Reply-To: <45CC9D35.8050202@aon.at>
References: 20070208233036.GK5871@wheat.betterworld.us
	<45CC9D35.8050202@aon.at>
Message-ID: <C8002483-F16D-468A-8551-E4E705E0DE4D@stat.berkeley.edu>

I have some experience wrapping code from Affymetrix in R (see the  
affxparser package). Depending on who actually wrote the package, you  
may find that it is not trivial to get it to work on different  
platforms. They are not always carefully to think about different  
compilers etc.

You may want to look at the plier package in Bioconductor to who they  
do it.

Of course this may or may not be related to your other C++ problems.

Kasper


On Feb 9, 2007, at 8:11 AM, cstrato wrote:

> Dear Ross
>
> Thank you  for this clarification, maybe there is something
> misconfigured on my Intel-Mac.
> BTW, I have now upgraded to XCode 2.4.1 from 2.4, but the result  
> remains
> the same.
>
> I don?t know if this could help clarify what might be wrong, but I am
> not able to compile
> plier, a simple package containing an R-wrapper around Affymetrix C++
> plier code.
> This is the output I get when trying to compile plier:
>
> m3450p027:/Volumes/CoreData/CRAN/Bioconductor/packages rabbitus$
> R_ARCH=/i386 R CMD INSTALL -l ~/Library/R/library plier_1.4.0.tar.gz
> * Installing *source* package 'plier' ...
> ** libs
> ** arch - i386
> g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/i386  -msse3
> -fPIC  -g -O2 -march=nocona -c affyplier.cpp -o affyplier.o
> /Volumes/CoreData/temp/cc3VRxb1.s:4750:indirect jmp without `*'
> /Volumes/CoreData/temp/cc3VRxb1.s:4769:indirect jmp without `*'
> /Volumes/CoreData/temp/cc3VRxb1.s:4784:indirect jmp without `*'
> /Volumes/CoreData/temp/cc3VRxb1.s:4799:indirect jmp without `*'
> /Volumes/CoreData/temp/cc3VRxb1.s:4818:indirect jmp without `*'
> /Volumes/CoreData/temp/cc3VRxb1.s:4833:indirect jmp without `*'
> g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/i386  -msse3
> -fPIC  -g -O2 -march=nocona -c plier_impl.cpp -o plier_impl.o
> /Volumes/CoreData/temp/ccLq6FYI.s:554:indirect jmp without `*'
> /Volumes/CoreData/temp/ccLq6FYI.s:569:indirect jmp without `*'
> /Volumes/CoreData/temp/ccLq6FYI.s:584:indirect jmp without `*'
> /Volumes/CoreData/temp/ccLq6FYI.s:599:indirect jmp without `*'
> /Volumes/CoreData/temp/ccLq6FYI.s:618:indirect jmp without `*'
> g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/i386  -msse3
> -fPIC  -g -O2 -march=nocona -c plieralg.cpp -o plieralg.o
> plieralg.cpp:30:20: error: malloc.h: No such file or directory
> make: *** [plieralg.o] Error 1
> chmod: /Users/rabbitus/Library/R/library/plier/libs/i386/*: No such  
> file
> or directory
> ** arch - ppc
> g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/ppc
> -I/usr/local/include    -fPIC  -g -O2 -c affyplier.cpp -o affyplier.o
> g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/ppc
> -I/usr/local/include    -fPIC  -g -O2 -c plier_impl.cpp -o  
> plier_impl.o
> g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/ppc
> -I/usr/local/include    -fPIC  -g -O2 -c plieralg.cpp -o plieralg.o
> plieralg.cpp:30:20: error: malloc.h: No such file or directory
> make: *** [plieralg.o] Error 1
> chmod: /Users/rabbitus/Library/R/library/plier/libs/ppc/*: No such  
> file
> or directory
> ERROR: compilation failed for package 'plier'
> ** Removing '/Users/rabbitus/Library/R/library/plier
>
> In any case, the problem seems to be R-specific, since the same  
> code for
> my package MyClass
> runs fine, when compiled as a shared library and called from other C 
> ++ code.
>
> BTW, since I do not have an url, I would like to attach my package, so
> that people could try it.
> In my initial mailing I have attached my package as
> MyClass_0.1.2.tar.gz, but it got scrambled
> as
> https://stat.ethz.ch/pipermail/r-devel/attachments/ 
> 20070204/2e7fb79c/attachment.gz
>
> Is there a possibility to attach it in a way so that people can use  
> it?
>
> Thank you
> Best regards
> Christian
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Problem using ofstream in C++ class in package for MacOS X
Kasper Daniel Hansen