[dtrace-discuss] DTrace #include problems

Adam Leventhal ahl at eng.sun.com
Sun Dec 11 22:18:26 PST 2005


Hey Ryan,

apr_thread_mutex.h is using the APR_POOL_DECLARE_ACCESSOR() macro defined
in apr_pools.h. THat macro uses the ## preprocessor concatenation operator,
and the very of cpp that dtrace(1M) uses by default (/usr/ccs/lib/cpp) is
rather old and crotchety and doesn't understand the operator.

You can work around this, by using another version of cpp, /usr/sfw/bin/cpp
for example:

  dtrace -xcpppath=/usr/sfw/bin/cpp -C -I/usr/apache2/include -e -s foo.d

Doing this allowed me to include apr_thread_mutex.h without a problem.

This begs the question, of course: why don't we just use that cpp by default
if the one in /usr/ccs/lib is so busted. We made this decision because
/usr/sfw is in a different consolidation (Solaris is made of several
consolidations of which the kernel is just one; Java and X are two others
for example) and creating a cross-consolidation dependency can be a bit
tricky. We have, however, been discussing this issue as more folks bump
into the limitations of /usr/ccs/lib/cpp, and we may change this in the
not-too-distant future.

Adam

On Sat, Dec 10, 2005 at 10:36:19PM -0500, Matty wrote:
> 
> Howdy,
> 
> I am getting errors when trying to include arbitrary header files:
> 
> $ dtrace -C -I/usr/apache2/include -s foo.d
> dtrace: failed to compile script foo.d: 
> "/usr/apache2/include/apr_thread_mutex.h", line 99: syntax error near "#"
> 
> And wondered if anyone has had an opportunity to look at this issue? I 
> would like to be able to use types in my DTrace scripts, but the 
> preprocessor issues are preventing me from doing so. :(
> 
> Thanks for any insight,
> - Ryan
> --
> UNIX Administrator
> http://daemons.net/~matty
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org

-- 
Adam Leventhal, Solaris Kernel Development       http://blogs.sun.com/ahl



More information about the dtrace-discuss mailing list