Re: building xlr on mac

10 views
Skip to first unread message

Christophe de Dinechin

unread,
Aug 28, 2011, 5:22:59 AM8/28/11
to Marc Coram, xlr-...@googlegroups.com
Hi Mark,


OSX is one of our primary build platforms, and we build it daily there. posix_memalign exists in 10.6. Your fix needs to be restricted to 10.5, as we cannot rely on undocumented OS behaviors.

The fix for the Makefile is unnecessary and subtly harmful. With your change, "make -j5" no longer builds the dependencies before evaluating the makefile. There's a bit of arcane magic there about OBJDIR not being set correctly the first time, IIRC.


Regards
Christophe

On 28 août 2011, at 07:31, Marc Coram wrote:

> Hi Christophe,
>
> I was trying to build xlr on my OS X machine. I needed to make a couple changes for it to compile. I'm not sure if these just reflect vagaries of my system or what.
> The first is one call to OBJDIR in Makefile.rules (it had an extra / in this instance, but not others; I do not understand this; perhaps there's a more uniform fix).
>
> ; git diff
> diff --git a/xlr/Makefile.rules b/xlr/Makefile.rules
> index e064a66..c5e87a3 100644
> --- a/xlr/Makefile.rules
> +++ b/xlr/Makefile.rules
> @@ -192,5 +192,5 @@ endif
>
> # Include dependencies from current directory
> ifdef SOURCES
> --include $(OBJDIR)/Makefile.depend
> +-include $(OBJDIR)Makefile.depend
> endif
> diff --git a/xlr/gc.cpp b/xlr/gc.cpp
> index eb90373..b44f90b 100644
> --- a/xlr/gc.cpp
> +++ b/xlr/gc.cpp
> @@ -316,10 +316,16 @@ void *TypeAllocator::operator new(size_t size)
> result = __mingw_aligned_malloc(size, PTR_MASK+1);
> if (!result)
> throw std::bad_alloc();
> +#else
> +#ifdef CONFIG_MACOSX // OS_X doesn't "need" alignment (c.f. http://stackoverflo
> w.com/questions/196329/osx-lacks-memalign)
> + result = malloc(size);
> + if (!result)
> + throw std::bad_alloc();
> #else // Real operating systems
> if (posix_memalign(&result, PTR_MASK+1, size))
> throw std::bad_alloc();
> -#endif // WINDOWS or real operating system
> +#endif // MACOSX or real operating system
> +#endif // WINDOWS or not
> return result;
> }
>
>

Christophe de Dinechin

unread,
Aug 28, 2011, 7:51:57 AM8/28/11
to xlr-...@googlegroups.com, Marc Coram

On 28 août 2011, at 11:22, Christophe de Dinechin wrote:

> The fix for the Makefile is unnecessary

To be more specific : I believe it is unecessary. I would appreciate if you could tell me why you thought it was required...

Also, I tried to find a way to detect 10.5 vs 10.6, and the only way I found was to use a MacOSX specific header, Availability.h. If there's a better way, I'd like to learn about it.


Thanks
Christophe

Marc Coram

unread,
Aug 28, 2011, 12:49:06 PM8/28/11
to xlr-...@googlegroups.com
Hi Christophe,

The fix for the Makefile was necessary on my 10.5.8 system to get the dependencies to build correctly (I was using "make clean;make" not "make -j5").
In particular, the
--include $(OBJDIR)/Makefile.depend
+-include $(OBJDIR)Makefile.depend
prevented an extra "/" in:
  obj/macosx/debug/Makefile.depend
the presence of which did cause very confusing recursive make issues and failure attempting to create this .depend file; something about multiple tries for that target. I could try to track down why, if you wanted. OBJDIR did not seem to be wrong at other stages of the build.

Anyway, I just tried everything afresh on a 10.6.8 system and it worked without modification, without flaw.

Thanks,

--Marc
Reply all
Reply to author
Forward
0 new messages