Discussion:
[MacPorts] #57630: bloc @ 1.14.4: build fails due to undefined symbols on OS X Leopard PPC
MacPorts
2018-11-17 04:48:35 UTC
Permalink
#57630: bloc @ 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
Keywords: | Port: blosc
--------------------------+------------------------
Build seems to go fine until it gets here:

{{{
:info:build /usr/bin/gcc-4.2 -pipe -Os -DNDEBUG -I/opt/local/include -arch
ppc -mmacosx-version-min=10.5 -Wl,-search_paths_first
-Wl,-headerpad_max_install_names -L/opt/local/lib
-Wl,-headerpad_max_install_names CMakeFiles/bench.dir/bench.c.o -o bench
-Wl,-rpath,/opt/local/lib ../blosc/libblosc.1.14.4.dylib
/opt/local/lib/liblz4.dylib /opt/local/lib/libz.dylib
/opt/local/lib/libzstd.dylib
:info:build Undefined symbols:
:info:build "_posix_memalign", referenced from:
:info:build _do_bench in bench.c.o
:info:build _do_bench in bench.c.o
:info:build _do_bench in bench.c.o
:info:build ld: symbol(s) not found
:info:build collect2: ld returned 1 exit status
:info:build make[2]: *** [bench/bench] Error 1
}}}
--
Ticket URL: <https://trac.macports.org/ticket/57630>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-17 04:48:52 UTC
Permalink
#57630: bloc @ 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:
Port: blosc |
---------------------------+------------------------
Changes (by SerpentChris):

* Attachment "main.log" added.
--
Ticket URL: <https://trac.macports.org/ticket/57630>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-17 08:29:41 UTC
Permalink
#57630: bloc @ 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:
Port: blosc |
---------------------------+------------------------

Comment (by kencu):

yep, there is no `posix_memalign` on 10.5. I've been thinking of adding it
to the `macports-legacy` port, and in fact I have written up the
replacement already, but it didn't always seem to work as I wanted it to,
so I'm still sitting on it for now.

Is this a port you really want on 10.5 PPC? You can use `valloc` instead,
to get a block of memory aligned on a page boundary.

It would take a minor patch to the source to make it use `valloc` instead
of `posix_memalign`, but it's a fairly trivial fix.
--
Ticket URL: <https://trac.macports.org/ticket/57630#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-17 09:56:57 UTC
Permalink
#57630: bloc @ 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:
Port: blosc |
---------------------------+----------------------
Changes (by jmroot):

* cc: stromnov@
 (removed)
* owner: stromnov@
 => stromnov
--
Ticket URL: <https://trac.macports.org/ticket/57630#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-17 16:34:26 UTC
Permalink
#57630: bloc @ 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 powerpc
Port: blosc |
---------------------------+-----------------------------
Changes (by mf2k):

* keywords: => leopard powerpc
--
Ticket URL: <https://trac.macports.org/ticket/57630#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-17 18:18:02 UTC
Permalink
#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 |
---------------------------+---------------------------
Changes (by kencu):

* keywords: leopard powerpc => leopard tiger
--
Ticket URL: <https://trac.macports.org/ticket/57630#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-17 21:33:52 UTC
Permalink
#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 kencu):

this little patch does the right thing. blosc builds, passes all but 4 of
the tests on 10.5 PPC. It didn't actually run the benchmark suite, so I
didn't prove that this patch actually worked, however. But the tests and
benchmark suite aren't installed by default anyway.
{{{
diff --git bench/bench.c bench/bench.c
index 39d6aeb..3bc617f 100644
--- bench/bench.c
+++ bench/bench.c
@@ -121,6 +121,18 @@ double get_usec_chunk(blosc_timestamp_t last,
blosc_timestamp_t current, int nit
return elapsed_usecs / (double)(niter * nchunks);
}

+#if defined __APPLE__ && MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+#include <sys/errno.h>
+int posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+ *memptr = valloc(size);
+ if (*memptr == NULL) {
+ return ENOMEM;
+ }
+ return 0;
+}
+#endif
+
/* Define posix_memalign for Windows */
#if defined(_WIN32)
#include <malloc.h>
}}}

You can check this out here if you want
<https://github.com/kencu/LeopardPorts/tree/master/archivers/blosc>. If it
works for you as well, we can put together a PR for it.

Best, K
--
Ticket URL: <https://trac.macports.org/ticket/57630#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-21 15:25:11 UTC
Permalink
#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
MacPorts
2018-11-21 15:28:08 UTC
Permalink
#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):

Oh, and the reason I want blosc on Leopard is to install py37-pandas. I'm
trying to get a fully modern scipy config running so I can help family
members with college homework.
--
Ticket URL: <https://trac.macports.org/ticket/57630#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-21 16:21:34 UTC
Permalink
#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 kencu):

you're right, I skipped an alignment vheck. I like your extra bits. I
think we can massage a bit more and find a way. If alignment is <16 we
could just use malloc, as macos guarantees 16 byte alignment at all times.

there.is a very complete replacement available called dlmalloc.c with a
very liberal license. I wasn't clear how to make it only cough up
posix_memalign without all the other memory functions trampling us.

For blosc, turns out the author has previosly spported macs < 10.6 in the
code; he's just added a new benchmark.c that doesn't . You can skip the
build of benchmark.c by turning off tests. Then you have what we had
before. My PR does that. So you can use that right now if you want...

btw blosc with or without the posix_memalign patch will pass nearly all
tests -- high 90s -- a i suspect it always did not get 100% on 10.5 PPC.

If you have interest, please consider helping add to the macports_legacy
project to help keep your PPC mac alive!
--
Ticket URL: <https://trac.macports.org/ticket/57630#comment:8>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-23 03:19:59 UTC
Permalink
#57630: blosc @ 1.14.4: build fails due to undefined symbols on OS X Leopard PPC
---------------------------+---------------------------
Reporter: SerpentChris | Owner: stromnov
Type: defect | Status: closed
Priority: Normal | Milestone:
Component: ports | Version: 2.5.4
Resolution: fixed | Keywords: leopard tiger
Port: blosc |
---------------------------+---------------------------
Changes (by kencu):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"591337f116ff9ae2ae20fab954605b943fcf7c30/macports-ports"
591337f116ff9ae2ae20fab954605b943fcf7c30/macports-ports] (master):
{{{
#!ConfigurableCommitTicketReference repository="macports-ports"
revision="591337f116ff9ae2ae20fab954605b943fcf7c30"
blosc: disable tests and benchmarks

not installed anyway
don't easily work
newer benchmarks use posix_memalign which fails on
some older systems

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