[lttng-dev] userspace-rcu-0.8.6 problems on MacOSX

Zifei Tong zifeitong at gmail.com
Fri Mar 13 05:05:25 EDT 2015


Hi,

I tried building urcu on my Yosemite laptop.

On Fri, Mar 13, 2015 at 1:24 AM, Alexandre Montplaisir
<alexmonthy at voxpopuli.im> wrote:
> Hi,
>
> Technically, liburcu is not supported on Mac, but if we can easily make it
> work, why not try!
>
> I tried compiling it on an OS X system (Yosemite, autoconf/automake
> installed from Homebrew), but got many errors like this one:
>
> In file included from wfcqueue.c:26:
>
> ./urcu/static/wfcqueue.h:260:22: error: passing 'struct __cds_wfcq_head *'
> to parameter of incompatible type 'cds_wfcq_head_ptr_t'
>
>         if (_cds_wfcq_empty(head, tail))
>
>                             ^~~~
>
> ./urcu/static/wfcqueue.h:132:56: note: passing argument to parameter
> 'u_head' here
>
> static inline bool _cds_wfcq_empty(cds_wfcq_head_ptr_t u_head,
>
>                                                        ^
>
> What steps did you use to make it compile?

gcc 4.9 from Homebrew works fine. For clang I have to apply a patch to move
'__attribute__((__transparent_union__))' after the union declaration.
I think this
might be a clang bug.

diff --git a/urcu/lfstack.h b/urcu/lfstack.h
index cd8e958..fa58054 100644
--- a/urcu/lfstack.h
+++ b/urcu/lfstack.h
@@ -84,10 +84,10 @@ struct cds_lfs_stack {
  * struct cds_lfs_stack and struct __cds_lfs_stack on any of those two
  * types.
  */
-typedef union __attribute__((__transparent_union__)) {
+typedef union {
  struct __cds_lfs_stack *_s;
  struct cds_lfs_stack *s;
-} cds_lfs_stack_ptr_t;
+} __attribute__((__transparent_union__)) cds_lfs_stack_ptr_t;

 #ifdef _LGPL_SOURCE

diff --git a/urcu/wfcqueue.h b/urcu/wfcqueue.h
index df26e33..9d78d1b 100644
--- a/urcu/wfcqueue.h
+++ b/urcu/wfcqueue.h
@@ -79,10 +79,10 @@ struct cds_wfcq_head {
  * struct cds_wfcq_head and struct __cds_wfcq_head on any of those two
  * types.
  */
-typedef union __attribute__((__transparent_union__)) {
+typedef union {
  struct __cds_wfcq_head *_h;
  struct cds_wfcq_head *h;
-} cds_wfcq_head_ptr_t;
+} __attribute__((__transparent_union__))  cds_wfcq_head_ptr_t;

 struct cds_wfcq_tail {
  struct cds_wfcq_node *p;
diff --git a/urcu/wfstack.h b/urcu/wfstack.h
index 362cacc..3ac3be4 100644
--- a/urcu/wfstack.h
+++ b/urcu/wfstack.h
@@ -97,10 +97,10 @@ struct cds_wfs_stack {
  * struct cds_wfs_stack and struct __cds_wfs_stack on any of those two
  * types.
  */
-typedef union __attribute__((__transparent_union__)) {
+typedef union {
  struct __cds_wfs_stack *_s;
  struct cds_wfs_stack *s;
-} cds_wfs_stack_ptr_t;
+} __attribute__((__transparent_union__))  cds_wfs_stack_ptr_t;

 #ifdef _LGPL_SOURCE

> Cheers,
> Alexandre
>
>
>
> On 2015-03-11 11:50 AM, Jim Reid wrote:
>>
>> Hi. There are some problems getting this to compile on MacOSX (10.9.5):
>>
>> 1) Many of the make regtest tests fail because the time command use
>> command line arguments. eg:
>>
>> ...
>> ./test_urcu_lgc 4 4 10 -d 2 -b 32768
>> /usr/bin/time: illegal option -- a
>> usage: time [-lp] command.
>> ...
>>
>> 2) The generated Makefiles feed Linuxy linker arguments (-Wl,-rpath==) to
>> the compiler.
>> I kludged that by manually editing the Makefile(s) to just use -L././libs
>> instead. Which would seem to be a better solution in general. YMMV.

Apparently, ld in OS X does not support -Wl,-rpath="/foo/bar" syntax,
simply replace '='
with space like -Wl,-rpath "/foo/bar" did the trick. I can send a
patch for this.

Thanks,
Zifei Tong

>> Could you please fix these for a future release? Thanks.
>>
>>
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev



More information about the lttng-dev mailing list