Re: libzzip fails to build on Snow Leopard -> snowleopardfixes can help also

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: libzzip fails to build on Snow Leopard -> snowleopardfixes can help also

Ken Cunningham
The same few missing glibc functions keep popping up over and over on snowleopard (and earlier), so I built a library that replaces the most common ones.

<https://github.com/kencu/snowleopardfixes>.

And a portfile to install it is here:

<https://github.com/kencu/SnowLeopardPorts/tree/master/sysutils/snowleopardfixes>


The beauty of this approach is that rather than picking through the individual source files and generating patches for each required file all the time, you can just add something like this directly to the Portfile:

platform darwin 10 {
        depends_lib-append port:snowleopardfixes
        configure.ldflags-append "-lsnowleopardfixes"
        configure.cxxflags-append -include ${prefix}/include/snowleopardfixes.h
        configure.cflags-append -include ${prefix}/include/snowleopardfixes.h
}

and it "just works" to replace the missing functions.

In the build below, I used the block above in the libzzip Portfile, and no patches to the source at all:

$ port -v installed libzzip
The following ports are currently installed:
  libzzip @0.13.62_1 platform='darwin 10' archs='x86_64' date='2016-08-11T10:12:43-0700'
  libzzip @0.13.66_0 (active) platform='darwin 10' archs='x86_64' date='2017-05-24T18:32:32-0700'


Of course platform darwin 10 could be a test for os.major <= 10 and cover all the older systems, but Leopard and Tiger have a few more things missing to be covered, so i'm thinking of separate replacement libraries for them.

It would be possible for all this to be included in a Portgroup, or even by default in the Macports source.

Ken
Reply | Threaded
Open this post in threaded view
|

Re: libzzip fails to build on Snow Leopard -> snowleopardfixes can help also

Mojca Miklavec
On 25 May 2017 at 03:58, Ken Cunningham wrote:

> The same few missing glibc functions keep popping up over and over on snowleopard (and earlier), so I built a library that replaces the most common ones.
>
> <https://github.com/kencu/snowleopardfixes>.
>
> And a portfile to install it is here:
>
> <https://github.com/kencu/SnowLeopardPorts/tree/master/sysutils/snowleopardfixes>
>
>
> The beauty of this approach is that rather than picking through the individual source files and generating patches for each required file all the time, you can just add something like this directly to the Portfile:
>
> platform darwin 10 {
>         depends_lib-append port:snowleopardfixes
>         configure.ldflags-append "-lsnowleopardfixes"
>         configure.cxxflags-append -include ${prefix}/include/snowleopardfixes.h
>         configure.cflags-append -include ${prefix}/include/snowleopardfixes.h
> }
>
> and it "just works" to replace the missing functions.
>
> In the build below, I used the block above in the libzzip Portfile, and no patches to the source at all:
>
> $ port -v installed libzzip
> The following ports are currently installed:
>   libzzip @0.13.62_1 platform='darwin 10' archs='x86_64' date='2016-08-11T10:12:43-0700'
>   libzzip @0.13.66_0 (active) platform='darwin 10' archs='x86_64' date='2017-05-24T18:32:32-0700'
>
>
> Of course platform darwin 10 could be a test for os.major <= 10 and cover all the older systems, but Leopard and Tiger have a few more things missing to be covered, so i'm thinking of separate replacement libraries for them.
>
> It would be possible for all this to be included in a Portgroup, or even by default in the Macports source.

I don't know what the cleanest approach would be, but I like the idea.
I can imagine a PortGroup, something in the spirit of:

    PortGroup legacy 1.0
    legacy.support darwin 10
    # legacy.support {darwin < 11}

which would add a dependency and append the necessary flags for darwin10.

(The library could be built statically.)

Mojca
Reply | Threaded
Open this post in threaded view
|

Re: libzzip fails to build on Snow Leopard -> snowleopardfixes can help also

Ken Cunningham

On 2017-05-25, at 12:32 AM, Mojca Miklavec wrote:

I don't know what the cleanest approach would be, but I like the idea.
I can imagine a PortGroup, something in the spirit of:

   PortGroup legacy 1.0
   legacy.support darwin 10
   # legacy.support {darwin < 11}

which would add a dependency and append the necessary flags for darwin10.

(The library could be built statically.)

Mojca

It works quite well, and it's easy to control. The only thing I can think of that would be better and even more transparent would be to link it in with clang when needed, as Apple has done with some other library functions, like this bit from the clang patches in ToolChains.cpp:

+    if (isMacosxVersionLT(10, 5))
       AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.10.4.a");
-    } else {
-      if (getTriple().getArch() == llvm::Triple::x86)
-        AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.eprintf.a");
+    else
       AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.osx.a");
-    }

This actually would be a pretty sweet way to go with this issue. 

You'd have to put that together with an #include_next for a copy of string.h and perhaps a few other headers that define the missing functions.

Of course, it's better for authors to test for all the missing functions, but as these are all common functions for the past 10+ years, that might be a bit too much to ask. 

Or I could just give up on 10.6.8 and get in the modern era :> 

Ken