[Pkg-ace-devel] Bug#420216: Bug#420216: libace-dev bug regarding _REENTRANT macro

Thomas Girard thomas.g.girard at free.fr
Thu May 17 15:31:11 UTC 2007


Hello Scott,

On Fri, Apr 20, 2007 at 03:33:19PM -0400, Scott D. Fleming wrote:
> Package: libace-dev
> Version: 5.4.7-12
> 
> I believe the libace-dev package maintainer responded to debian bug
> report #380739 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=380739)
> incorrectly, and introduced a portability bug into the ACE sources.
> 
> Bug report #380739 describes a compatibility problem between ACE and
> Boost (libace-dev and libboost-dev). I believe the correct response to
> that bug report would have been to say, "compatibility between these
> libraries is not a feature supported by either library; therefore, I'm
> sorry, but I cannot help you. To resolve your problem, you will need
> send the library developers a request for the addition of that
> feature." Instead, the package maintainer attempted to solve the
> compatibility problem by modifying the ACE sources. Specifically, the
> maintainer changed the following stanza in ace/config-lite.h:
> 
> # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
> #   define ACE_MT(X) X
> #   if !defined (_REENTRANT)
> #     define _REENTRANT
> #   endif /* _REENTRANT */
> # else
> ...
> 
> To this:
> 
> # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
> #   define ACE_MT(X) X
> #   if !defined (_REENTRANT)
> #     error _REENTRANT has to be defined!
> #   endif /* _REENTRANT */
> # else
> ...
> 
> Note that instead of having the header define the _REENTRANT macro, it
> now reports an error. Unfortunately, this change introduces a
> portability bug into ACE. The problem arises because _REENTRANT is a
> platform-specific macro. By removing the macro definition from the ace
> header, the package maintainer forces users of ACE to define it
> explicity (either in their code or via a compiler flag). However, this
> undermines one of the primary benefits of ACE -- portability (see
> http://www.cs.wustl.edu/~schmidt/ACE-overview.html); ACE is supposed
> to shield it users from such platform-dependent concerns.
> 
> To put it another way, I expect to be able to write the following
> simple ACE-based C++ program (ace-bug.cc):
> 
>  #include <iostream>
>  #include <ace/OS_main.h>
> 
>  int ACE_MAIN(int argc, char* argv[])
>  {
>    std::cout << "Hello, world" << std::endl;
>    return 0;
>  }
> 
> And I should be able to compile it with this command (on any platform
> that ACE supports):
> 
>  g++ `pkg-config --cflags ACE` ace-bug.cc `pkg-config --libs ACE`
> 
> But, with the current implementation of the package, I get the error:
> 
>  In file included from /usr/include/ace/ACE_export.h:11,
>                   from /usr/include/ace/OS_main.h:17,
>                   from ace-bug.cc:3:
>  /usr/include/ace/config-lite.h:71:7: error: #error _REENTRANT has to
> be defined!
> 
> I think the best solution to this bug is to revert the config-lite.h
> stanza shown above to its original form.
> 
> An alternate solution would be to modify the /usr/lib/pkgconfig/ACE.pc
> so that it includes "-D_REENTRANT" in its Cflags section. However, I
> consider this to be a weaker solution.

Thanks for the nice summary, and sorry for the delay in my reply.

I agree this breaks your very simple use case. The workaround is, as you
suggest, to add `-D_REENTRANT' or, better yet, to add `-pthreads'.

I still believe it's better to have a compile-time error than a runtime
one. But you're right, this should have been discussed with upstream.
In fact, it was already mentioned in [1], but it did not get enough
attention.

I'll repost a request for comment on this.

Regards,

Thomas

[1] http://groups.google.com/group/comp.soft-sys.ace/browse_thread/thread/bf00a104ab72816c/322ba3f9eb7f6c11?lnk=gst&rnum=5#322ba3f9eb7f6c11




More information about the Pkg-ace-devel mailing list