How to install on 10.15 with deployment target as 10.13?

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

How to install on 10.15 with deployment target as 10.13?

Sandeep Thakkar
Hi,

I'm compiling postgres with LLVM support on macOS 10.15 Catalina. The binaries are supported on 10.13+. On target machine (10.13), the library fails to load with the following error:

dlopen(/Library/PostgreSQL/13/lib/postgresql/llvmjit.so, 10): Symbol not found: ____chkstk_darwin

I guess this is because:
$ otool -l /opt/local/libexec/llvm-8.0/lib/*.dylib | grep -B1 -A3 minos
       sdk 10.15
     minos 10.15

Before I installed LLVM-8.0 using macports on 10.15, I appended /opt/local/etc/macports/macports.conf file with "macosx_deployment_target   10.13"

and also did "export MACOSX_DEPLOYMENT_TARGET=10.13" on the terminal where I executed port install clang-8.0


--
Sandeep Thakkar


Reply | Threaded
Open this post in threaded view
|

Re: How to install on 10.15 with deployment target as 10.13?

ryandesign2
Administrator


On Jun 25, 2020, at 23:15, Sandeep Thakkar wrote:

>
> I'm compiling postgres with LLVM support on macOS 10.15 Catalina. The binaries are supported on 10.13+. On target machine (10.13), the library fails to load with the following error:
>
> dlopen(/Library/PostgreSQL/13/lib/postgresql/llvmjit.so, 10): Symbol not found: ____chkstk_darwin
>
> I guess this is because:
> $ otool -l /opt/local/libexec/llvm-8.0/lib/*.dylib | grep -B1 -A3 minos
>        sdk 10.15
>      minos 10.15
>
> Before I installed LLVM-8.0 using macports on 10.15, I appended /opt/local/etc/macports/macports.conf file with "macosx_deployment_target   10.13"

That should be enough, if you build from source. You might have received a binary from our server instead, which was built without that setting. Set "buildfromsource always" in macports.conf, and uninstall and reinstall postgres and all of its dependencies.

If you want to use this MacPorts prefix for other things that don't need a nonstandard deployment target and you want to be able to receive binaries of those, then I recommend you leave your main MacPorts prefix /opt/local set for the default deployment target and keep binaries enabled, and install a second copy of MacPorts somewhere else like /opt/macportsfor10.13 and set its macports.conf for the 10.13 deployment target. MacPorts isn't able to use binaries for nondefault MacPorts prefixes anyway.


> and also did "export MACOSX_DEPLOYMENT_TARGET=10.13" on the terminal where I executed port install clang-8.0

MacPorts will intentionally ignore this and most other environment variables you set.


Reply | Threaded
Open this post in threaded view
|

Re: How to install on 10.15 with deployment target as 10.13?

Ken Cunningham
In reply to this post by Sandeep Thakkar
> Hi, I'm compiling postgres with LLVM support on macOS 10.15 Catalina. The binaries are supported on 10.13+. On target machine (10.13), the library fails to load with the following error: *dlopen(/Library/PostgreSQL/13/lib/postgresql/llvmjit.so, 10): Symbol not found: ____chkstk_darwin*

I believe you will have to compile your software built on 10.15 and to be deployed on earlier systems with:

configure.cflags-append -fno-stack-check
configure.cxxflags-append -fno-stack-check

to disable the now-default stack-checking feature used in Xcode 11.

The  ____chkstk_darwin symbol is not found on 10.13 it appears, and although there are versions of that symbol added to compiler_rt for other systems like WIndows, etc, it is apparently expected to be found in the system libraries on Darwin.

Ken
Reply | Threaded
Open this post in threaded view
|

Re: How to install on 10.15 with deployment target as 10.13?

Sandeep Thakkar
In reply to this post by ryandesign2


On Fri, Jun 26, 2020 at 10:41 AM Ryan Schmidt <[hidden email]> wrote:


On Jun 25, 2020, at 23:15, Sandeep Thakkar wrote:
>
> I'm compiling postgres with LLVM support on macOS 10.15 Catalina. The binaries are supported on 10.13+. On target machine (10.13), the library fails to load with the following error:
>
> dlopen(/Library/PostgreSQL/13/lib/postgresql/llvmjit.so, 10): Symbol not found: ____chkstk_darwin
>
> I guess this is because:
> $ otool -l /opt/local/libexec/llvm-8.0/lib/*.dylib | grep -B1 -A3 minos
>        sdk 10.15
>      minos 10.15
>
> Before I installed LLVM-8.0 using macports on 10.15, I appended /opt/local/etc/macports/macports.conf file with "macosx_deployment_target   10.13"

That should be enough, if you build from source. You might have received a binary from our server instead, which was built without that setting. Set "buildfromsource always" in macports.conf, and uninstall and reinstall postgres and all of its dependencies.

you are right, I missed that.
 
If you want to use this MacPorts prefix for other things that don't need a nonstandard deployment target and you want to be able to receive binaries of those, then I recommend you leave your main MacPorts prefix /opt/local set for the default deployment target and keep binaries enabled, and install a second copy of MacPorts somewhere else like /opt/macportsfor10.13 and set its macports.conf for the 10.13 deployment target. MacPorts isn't able to use binaries for nondefault MacPorts prefixes anyway.

that's a nice idea. Thanks for sharing.

> and also did "export MACOSX_DEPLOYMENT_TARGET=10.13" on the terminal where I executed port install clang-8.0

MacPorts will intentionally ignore this and most other environment variables you set.

OK.

Thanks once again for your quick help.

--
Sandeep Thakkar


Reply | Threaded
Open this post in threaded view
|

Re: How to install on 10.15 with deployment target as 10.13?

Sandeep Thakkar
In reply to this post by Ken Cunningham


On Fri, Jun 26, 2020 at 10:52 AM Ken Cunningham <[hidden email]> wrote:
> Hi, I'm compiling postgres with LLVM support on macOS 10.15 Catalina. The binaries are supported on 10.13+. On target machine (10.13), the library fails to load with the following error: *dlopen(/Library/PostgreSQL/13/lib/postgresql/llvmjit.so, 10): Symbol not found: ____chkstk_darwin*

I believe you will have to compile your software built on 10.15 and to be deployed on earlier systems with:

configure.cflags-append -fno-stack-check
configure.cxxflags-append -fno-stack-check

to disable the now-default stack-checking feature used in Xcode 11.

OK, let me check that. Thanks
 
The  ____chkstk_darwin symbol is not found on 10.13 it appears, and although there are versions of that symbol added to compiler_rt for other systems like WIndows, etc, it is apparently expected to be found in the system libraries on Darwin.

Ken


--
Sandeep Thakkar


Reply | Threaded
Open this post in threaded view
|

Re: How to install on 10.15 with deployment target as 10.13?

ryandesign2
Administrator
In reply to this post by Ken Cunningham


On Jun 26, 2020, at 00:22, Ken Cunningham wrote:

> I believe you will have to compile your software built on 10.15 and to be deployed on earlier systems with:
>
> configure.cflags-append -fno-stack-check
> configure.cxxflags-append -fno-stack-check
>
> to disable the now-default stack-checking feature used in Xcode 11.

Hmm. If that's true, MacPorts doesn't support that yet. There isn't a supported way for users to modify the cflags/cxxflags ports use by default. If those flags really are necessary for software compiled on 10.15 to run on < 10.15, then perhaps MacPorts base should add those flags to the default flags if the deployment target is set to < 10.15 when on a 10.15+ system.

Reply | Threaded
Open this post in threaded view
|

Re: How to install on 10.15 with deployment target as 10.13?

Ken Cunningham
In reply to this post by Sandeep Thakkar
Hmm. If that's true, MacPorts doesn't support that yet.
Let's see if it solves this fellow's problem. Many similar reports on Google about this error in this situation, with this solution. 

Turning off stack checking is a blunt fix, to be sure. 

That symbol is found by dyld at runtime ... didn't grep it in my libSystem.dylib on Catalina, though. Still looking for it.

Indeed -- odd that this wouldn't be handled by Xcode and/or ld64 automatically based on deployment target... maybe it is.  Some reports said it was meant to be a weak-linked symbol, which would make sense. If so, some software builds might override that with no-weak or similar issues, and cause errors.

Ken