[MacPorts] #57630: blosc @ 1.14.4: build fails due to undefined symbols on OS X Leopard PPC

MacPorts noreply at macports.org
Wed Nov 21 15:25:11 UTC 2018


#57630: blosc @ 1.14.4: build fails due to undefined symbols on OS X Leopard PPC
---------------------------+---------------------------
  Reporter:  SerpentChris  |      Owner:  stromnov
      Type:  defect        |     Status:  assigned
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.5.4
Resolution:                |   Keywords:  leopard tiger
      Port:  blosc         |
---------------------------+---------------------------

Comment (by SerpentChris):

 Your patch doesn't check the alignment argument the way it is supposed to.
 Shouldn't a posix_memalign look more like this?

 {{{
 #include <stdlib.h>
 #include <errno.h>

 const size_t _SIZE_OF_VOID_PTR = sizeof(void *);

 bool
 check_power_of_two(int val)
 {
   while(val&1 == 0){
     val >>= 1;
   }
   return (val == 1);
 }

 int
 posix_memalign(void **memptr, size_t alignment, size_t size)
 {
   // First check alignment
   div_t result = divmod(alignment, _SIZE_OF_VOID_PTR);
   if(!(result.rem == 0 && check_power_of_two(result.quot))){
     *memptr = NULL;
     return EINVAL;
   }
   // Do nothing if size is 0
   if(size == 0){
     *memptr = NULL;
     return 0;
   }

   errno = 0;
   *memptr = valloc(size);
   // If valloc errors, it will set errno to ENOMEM.
   // Folks online don't like posix_memalign to set errno though.
   // Also, if valloc errors it will return NULL which is OK.
   if(errno == ENOMEM){
     errno = 0;
     return ENOMEM;
   }

   return 0;
 }

 }}}

 The problem with this (besides the fact that I haven't tested it yet ;) is
 that the result might not be aligned properly if the alignment is greater
 than the page size, but I bet that is typically not the case anyway.

-- 
Ticket URL: <https://trac.macports.org/ticket/57630#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list