Linking on OSX

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

Linking on OSX

Bryan Christ
New to this mailing list so I hope I'm asking this in the right venue...

I'm trying to port my application (a program and a shared library) to OSX.  It was rather easy to modify my CMake script to go from Linux and add in FreeBSD.  OSX is giving me a lot of problems though.

First of all find_package() doesn't seem to find the ncurses.dylib installed by XCode as it test for wsyncup().  For whatever reason, that test fails.  The default location for the library is pretty sane (/usr/lib/) but the include file for ncurses is about 9 directories deep inside of XCode's install directory.  Lots of problems here so I decided to look at the symbol linkage for htop and see what it does.  It links to a different version that got pulled down via homebrew in /usr/local/opt/ncurses/lib (and include respectively)

Is there a way to force CMake to link to the library found there instead of in /usr/lib/ ?

--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Juan E. Sanchez
Hello,

According to this:
https://github.com/neovim/neovim/issues/9050

It looks like macOS made it so you have to do something like this:
open
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

for libraries and includes to be put into /usr.

Regards,

Juan


On 6/3/19 5:16 PM, Bryan Christ wrote:

> New to this mailing list so I hope I'm asking this in the right venue...
>
> I'm trying to port my application (a program and a shared library) to
> OSX.  It was rather easy to modify my CMake script to go from Linux and
> add in FreeBSD.  OSX is giving me a lot of problems though.
>
> First of all find_package() doesn't seem to find the ncurses.dylib
> installed by XCode as it test for wsyncup().  For whatever reason, that
> test fails.  The default location for the library is pretty sane
> (/usr/lib/) but the include file for ncurses is about 9 directories deep
> inside of XCode's install directory.  Lots of problems here so I decided
> to look at the symbol linkage for htop and see what it does.  It links
> to a different version that got pulled down via homebrew in
> /usr/local/opt/ncurses/lib (and include respectively)
>
> Is there a way to force CMake to link to the library found there instead
> of in /usr/lib/ ?
>
> --
> Bryan
> <><
>

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
Jaun,

Thank you for pointing out that thread / issue.  It's a rather thread, but soooo much I've what I'm experiencing is characterized in there.  I'll look tomorrow and reply with results.

On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez <[hidden email]> wrote:
Hello,

According to this:
https://github.com/neovim/neovim/issues/9050

It looks like macOS made it so you have to do something like this:
open
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

for libraries and includes to be put into /usr.

Regards,

Juan


On 6/3/19 5:16 PM, Bryan Christ wrote:
> New to this mailing list so I hope I'm asking this in the right venue...
>
> I'm trying to port my application (a program and a shared library) to
> OSX.  It was rather easy to modify my CMake script to go from Linux and
> add in FreeBSD.  OSX is giving me a lot of problems though.
>
> First of all find_package() doesn't seem to find the ncurses.dylib
> installed by XCode as it test for wsyncup().  For whatever reason, that
> test fails.  The default location for the library is pretty sane
> (/usr/lib/) but the include file for ncurses is about 9 directories deep
> inside of XCode's install directory.  Lots of problems here so I decided
> to look at the symbol linkage for htop and see what it does.  It links
> to a different version that got pulled down via homebrew in
> /usr/local/opt/ncurses/lib (and include respectively)
>
> Is there a way to force CMake to link to the library found there instead
> of in /usr/lib/ ?
>
> --
> Bryan
> <><
>

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
In reply to this post by Juan E. Sanchez
Juan,

Thanks for your suggestions.  I went through that thread pretty thoroughly trying all of the recommended tips and, unfortunately, nothing seemed to work.  I also tried running that open command you cited, but there are still no includes for ncurses in /usr/include or /usr/local/include.  In fact /usr/include doesn't even exist on this system (mojave).

On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez <[hidden email]> wrote:
Hello,

According to this:
https://github.com/neovim/neovim/issues/9050

It looks like macOS made it so you have to do something like this:
open
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

for libraries and includes to be put into /usr.

Regards,

Juan


On 6/3/19 5:16 PM, Bryan Christ wrote:
> New to this mailing list so I hope I'm asking this in the right venue...
>
> I'm trying to port my application (a program and a shared library) to
> OSX.  It was rather easy to modify my CMake script to go from Linux and
> add in FreeBSD.  OSX is giving me a lot of problems though.
>
> First of all find_package() doesn't seem to find the ncurses.dylib
> installed by XCode as it test for wsyncup().  For whatever reason, that
> test fails.  The default location for the library is pretty sane
> (/usr/lib/) but the include file for ncurses is about 9 directories deep
> inside of XCode's install directory.  Lots of problems here so I decided
> to look at the symbol linkage for htop and see what it does.  It links
> to a different version that got pulled down via homebrew in
> /usr/local/opt/ncurses/lib (and include respectively)
>
> Is there a way to force CMake to link to the library found there instead
> of in /usr/lib/ ?
>
> --
> Bryan
> <><
>

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
In reply to this post by Juan E. Sanchez
Juan,

In my case I was looking to build and link against ncurses.  A second set of libs got installed by homebrew so I decided to use those instead.  To use the alternate location, I was told the following would work (and it did).

set(CMAKE_PREFIX_PATH /usr/local/opt/ncurses)



On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez <[hidden email]> wrote:
Hello,

According to this:
https://github.com/neovim/neovim/issues/9050

It looks like macOS made it so you have to do something like this:
open
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

for libraries and includes to be put into /usr.

Regards,

Juan


On 6/3/19 5:16 PM, Bryan Christ wrote:
> New to this mailing list so I hope I'm asking this in the right venue...
>
> I'm trying to port my application (a program and a shared library) to
> OSX.  It was rather easy to modify my CMake script to go from Linux and
> add in FreeBSD.  OSX is giving me a lot of problems though.
>
> First of all find_package() doesn't seem to find the ncurses.dylib
> installed by XCode as it test for wsyncup().  For whatever reason, that
> test fails.  The default location for the library is pretty sane
> (/usr/lib/) but the include file for ncurses is about 9 directories deep
> inside of XCode's install directory.  Lots of problems here so I decided
> to look at the symbol linkage for htop and see what it does.  It links
> to a different version that got pulled down via homebrew in
> /usr/local/opt/ncurses/lib (and include respectively)
>
> Is there a way to force CMake to link to the library found there instead
> of in /usr/lib/ ?
>
> --
> Bryan
> <><
>

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Guy Harris
In reply to this post by Bryan Christ
On Jun 4, 2019, at 10:56 AM, Bryan Christ <[hidden email]> wrote:

> Thanks for your suggestions.  I went through that thread pretty thoroughly trying all of the recommended tips and, unfortunately, nothing seemed to work.  I also tried running that open command you cited, but there are still no includes for ncurses in /usr/include or /usr/local/include.

Presumably after you ran the open command you then performed an installation of the package from the window that the command popped up?

If not, you need to do that.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Guy Harris
In reply to this post by Juan E. Sanchez
On Jun 3, 2019, at 3:27 PM, Juan E. Sanchez <[hidden email]> wrote:

> It looks like macOS made it so you have to do something like this:
> open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
>
> for libraries and includes to be put into /usr.

*Libraries* should exist in /usr/lib regardless of whether you do that, or even whether you have Xcode, or the command-line developer tools, installed - if you don't have the shared libraries in /usr/lib, programs using the libraries won't work, and programs shipped with macOS use, at minimum, libSystem, and may use other libraries.  vi, for example, uses the ncurses library.

It's the *headers* that aren't installed in /usr/include by default.  The compiler *should* look in the directory where they're installed, however.

Note that macOS 10.15 Catalina apparently has a separate read-only volume that contains all the executables and libraries, and presumably including /usr, so it may be *impossible* to arrange, on 10.15, that there be a /usr/include directory.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
Guy,

I would agree with you, but I've been told that OSX is moving away from it's Unix heritage and placing libraries in non-traditional locations (not /usr or /usr/local) and that's going to be increasingly the norm in the future.



On Tue, Jun 4, 2019 at 3:24 PM Guy Harris <[hidden email]> wrote:
On Jun 3, 2019, at 3:27 PM, Juan E. Sanchez <[hidden email]> wrote:

> It looks like macOS made it so you have to do something like this:
> open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
>
> for libraries and includes to be put into /usr.

*Libraries* should exist in /usr/lib regardless of whether you do that, or even whether you have Xcode, or the command-line developer tools, installed - if you don't have the shared libraries in /usr/lib, programs using the libraries won't work, and programs shipped with macOS use, at minimum, libSystem, and may use other libraries.  vi, for example, uses the ncurses library.

It's the *headers* that aren't installed in /usr/include by default.  The compiler *should* look in the directory where they're installed, however.

Note that macOS 10.15 Catalina apparently has a separate read-only volume that contains all the executables and libraries, and presumably including /usr, so it may be *impossible* to arrange, on 10.15, that there be a /usr/include directory.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Guy Harris
On Jun 4, 2019, at 1:33 PM, Bryan Christ <[hidden email]> wrote:

> I would agree with you, but I've been told that OSX is moving away from it's Unix heritage and placing libraries in non-traditional locations (not /usr or /usr/local) and that's going to be increasingly the norm in the future.
>
> https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja

That talks about *headers*, not *libraries*.  (Don't be confused by the "/Library" used in some path names in that item - /Library has more than libraries in it.)

macOS has, all the way back to when it was called "Mac OS X", had a notion of "frameworks", which are not installed under /usr/lib, and that contain dynamically-linked shared libraries; the higher-level Cocoa APIs, for example, are provided as frameworks, as are C libraries such as Core Foundation.

UNIX APIs, however, are, and have always been, implemented as regular dynamically-linked shared libraries under /usr/lib.

The executable image for Microsoft Word for Mac has the strings

        /usr/lib/libz.1.dylib
        /usr/lib/libsqlite3.dylib
        /usr/lib/libobjc.A.dylib
        /usr/lib/libc++.1.dylib
        /usr/lib/libSystem.B.dylib

built into it as library paths; if Apple were to decide to put UNIX libraries somewhere other than /usr/lib, and not have a /usr/lib symbolic link pointing to the new location, the run-time linker would have to extract the final component of paths beginning with /usr/lib and treat them as if they pointed to a library in the new location, instead; they could probably do that, but it's not clear what the point of doing so would be.

So if somebody were to claim that macOS will be putting *UNIX libraries* (as opposed to macOS frameworks, or header files) in some location other than /usr/lib, I'd have to ask for some pretty solid evidence to believe that claim; I haven't seen any such evidence so far.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
In reply to this post by Guy Harris
Yes.  Unfortunately, I still don't get the wide version of ncurses so I have to point elsewhere.  But even assuming that solved my problem , I understand the procedure is a stop-gap and might not eventually be supported. 

On Tue, Jun 4, 2019 at 4:01 PM Guy Harris <[hidden email]> wrote:
On Jun 4, 2019, at 10:56 AM, Bryan Christ <[hidden email]> wrote:

> Thanks for your suggestions.  I went through that thread pretty thoroughly trying all of the recommended tips and, unfortunately, nothing seemed to work.  I also tried running that open command you cited, but there are still no includes for ncurses in /usr/include or /usr/local/include.

Presumably after you ran the open command you then performed an installation of the package from the window that the command popped up?

If not, you need to do that.


--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
In reply to this post by Guy Harris
Thanks for the explanation.  Yes.  The use of the term Library certainly added to my confusion.  I've been coding on Linux for 20 and the "proper" way of doing things on Mac is a bit elusive to me as I stumble around.



On Tue, Jun 4, 2019 at 4:21 PM Guy Harris <[hidden email]> wrote:
On Jun 4, 2019, at 1:33 PM, Bryan Christ <[hidden email]> wrote:

> I would agree with you, but I've been told that OSX is moving away from it's Unix heritage and placing libraries in non-traditional locations (not /usr or /usr/local) and that's going to be increasingly the norm in the future.
>
> https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja

That talks about *headers*, not *libraries*.  (Don't be confused by the "/Library" used in some path names in that item - /Library has more than libraries in it.)

macOS has, all the way back to when it was called "Mac OS X", had a notion of "frameworks", which are not installed under /usr/lib, and that contain dynamically-linked shared libraries; the higher-level Cocoa APIs, for example, are provided as frameworks, as are C libraries such as Core Foundation.

UNIX APIs, however, are, and have always been, implemented as regular dynamically-linked shared libraries under /usr/lib.

The executable image for Microsoft Word for Mac has the strings

        /usr/lib/libz.1.dylib
        /usr/lib/libsqlite3.dylib
        /usr/lib/libobjc.A.dylib
        /usr/lib/libc++.1.dylib
        /usr/lib/libSystem.B.dylib

built into it as library paths; if Apple were to decide to put UNIX libraries somewhere other than /usr/lib, and not have a /usr/lib symbolic link pointing to the new location, the run-time linker would have to extract the final component of paths beginning with /usr/lib and treat them as if they pointed to a library in the new location, instead; they could probably do that, but it's not clear what the point of doing so would be.

So if somebody were to claim that macOS will be putting *UNIX libraries* (as opposed to macOS frameworks, or header files) in some location other than /usr/lib, I'd have to ask for some pretty solid evidence to believe that claim; I haven't seen any such evidence so far.


--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Guy Harris
On Jun 4, 2019, at 2:27 PM, Bryan Christ <[hidden email]> wrote:

> Thanks for the explanation.  Yes.  The use of the term Library certainly added to my confusion.  I've been coding on Linux for 20 and the "proper" way of doing things on Mac is a bit elusive to me as I stumble around.

Yeah, it must be weird going from a system that stuffs libraries in /usr/lib64 to a system that stuffs them in /usr/lib. :-)

(There's no need to put 32-bit and 64-bit libraries in separate directories if you can put the 32-bit and 64-bit versions of a library in the same file, as you can in Darwin.

But the real point is that every UN*X has its own quirks, and somebody might find the UN*X with which you're most familiar to be the quirky one.  If you're going to do cross-platform UN*X programming, be prepared to have assumptions about UN*X, made based on the platform or platforms with which you're familiar, to be violated by some other UN*X.)
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
Indeed.  They all have their nuances :)

On Tue, Jun 4, 2019 at 4:36 PM Guy Harris <[hidden email]> wrote:
On Jun 4, 2019, at 2:27 PM, Bryan Christ <[hidden email]> wrote:

> Thanks for the explanation.  Yes.  The use of the term Library certainly added to my confusion.  I've been coding on Linux for 20 and the "proper" way of doing things on Mac is a bit elusive to me as I stumble around.

Yeah, it must be weird going from a system that stuffs libraries in /usr/lib64 to a system that stuffs them in /usr/lib. :-)

(There's no need to put 32-bit and 64-bit libraries in separate directories if you can put the 32-bit and 64-bit versions of a library in the same file, as you can in Darwin.

But the real point is that every UN*X has its own quirks, and somebody might find the UN*X with which you're most familiar to be the quirky one.  If you're going to do cross-platform UN*X programming, be prepared to have assumptions about UN*X, made based on the platform or platforms with which you're familiar, to be violated by some other UN*X.)


--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Juan E. Sanchez
In reply to this post by Bryan Christ
Hello,

It looks like you are making progress.  Note that to use the gcc-8 and
g++-8 compilers from brew, you need to have include files in
/usr/include.  Otherwise you get strange errors about missing _stdio.h,
etc.  I believe in another thread, someone suggests how to make sure the
headers get put in the right place.

I looked and found curses.h (not ncurses.h) here.
/usr/include/curses.h.

Regards,

Juan


On 6/4/19 12:56 PM, Bryan Christ wrote:

> Juan,
>
> Thanks for your suggestions.  I went through that thread pretty
> thoroughly trying all of the recommended tips and, unfortunately,
> nothing seemed to work.  I also tried running that open command you
> cited, but there are still no includes for ncurses in /usr/include or
> /usr/local/include.  In fact /usr/include doesn't even exist on this
> system (mojave).
>
> On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello,
>
>     According to this:
>     https://github.com/neovim/neovim/issues/9050
>
>     It looks like macOS made it so you have to do something like this:
>     open
>     /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
>
>     for libraries and includes to be put into /usr.
>
>     Regards,
>
>     Juan
>
>
>     On 6/3/19 5:16 PM, Bryan Christ wrote:
>      > New to this mailing list so I hope I'm asking this in the right
>     venue...
>      >
>      > I'm trying to port my application (a program and a shared
>     library) to
>      > OSX.  It was rather easy to modify my CMake script to go from
>     Linux and
>      > add in FreeBSD.  OSX is giving me a lot of problems though.
>      >
>      > First of all find_package() doesn't seem to find the ncurses.dylib
>      > installed by XCode as it test for wsyncup().  For whatever
>     reason, that
>      > test fails.  The default location for the library is pretty sane
>      > (/usr/lib/) but the include file for ncurses is about 9
>     directories deep
>      > inside of XCode's install directory.  Lots of problems here so I
>     decided
>      > to look at the symbol linkage for htop and see what it does.  It
>     links
>      > to a different version that got pulled down via homebrew in
>      > /usr/local/opt/ncurses/lib (and include respectively)
>      >
>      > Is there a way to force CMake to link to the library found there
>     instead
>      > of in /usr/lib/ ?
>      >
>      > --
>      > Bryan
>      > <><
>      >
>
>     --
>
>     Powered by www.kitware.com <http://www.kitware.com>
>
>     Please keep messages on-topic and check the CMake FAQ at:
>     http://www.cmake.org/Wiki/CMake_FAQ
>
>     Kitware offers various services to support the CMake community. For
>     more information on each offering, please visit:
>
>     CMake Support: http://cmake.org/cmake/help/support.html
>     CMake Consulting: http://cmake.org/cmake/help/consulting.html
>     CMake Training Courses: http://cmake.org/cmake/help/training.html
>
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
>
>     Follow this link to subscribe/unsubscribe:
>     https://cmake.org/mailman/listinfo/cmake
>
>
>
> --
> Bryan
> <><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Linking on OSX

Bryan Christ
Yes.  Unfortunately the version of curses which is supplied by XCode doesn't include the wide character support so I have to point elsewhere.

On Tue, Jun 4, 2019 at 5:57 PM Juan E. Sanchez <[hidden email]> wrote:
Hello,

It looks like you are making progress.  Note that to use the gcc-8 and
g++-8 compilers from brew, you need to have include files in
/usr/include.  Otherwise you get strange errors about missing _stdio.h,
etc.  I believe in another thread, someone suggests how to make sure the
headers get put in the right place.

I looked and found curses.h (not ncurses.h) here.
/usr/include/curses.h.

Regards,

Juan


On 6/4/19 12:56 PM, Bryan Christ wrote:
> Juan,
>
> Thanks for your suggestions.  I went through that thread pretty
> thoroughly trying all of the recommended tips and, unfortunately,
> nothing seemed to work.  I also tried running that open command you
> cited, but there are still no includes for ncurses in /usr/include or
> /usr/local/include.  In fact /usr/include doesn't even exist on this
> system (mojave).
>
> On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello,
>
>     According to this:
>     https://github.com/neovim/neovim/issues/9050
>
>     It looks like macOS made it so you have to do something like this:
>     open
>     /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
>
>     for libraries and includes to be put into /usr.
>
>     Regards,
>
>     Juan
>
>
>     On 6/3/19 5:16 PM, Bryan Christ wrote:
>      > New to this mailing list so I hope I'm asking this in the right
>     venue...
>      >
>      > I'm trying to port my application (a program and a shared
>     library) to
>      > OSX.  It was rather easy to modify my CMake script to go from
>     Linux and
>      > add in FreeBSD.  OSX is giving me a lot of problems though.
>      >
>      > First of all find_package() doesn't seem to find the ncurses.dylib
>      > installed by XCode as it test for wsyncup().  For whatever
>     reason, that
>      > test fails.  The default location for the library is pretty sane
>      > (/usr/lib/) but the include file for ncurses is about 9
>     directories deep
>      > inside of XCode's install directory.  Lots of problems here so I
>     decided
>      > to look at the symbol linkage for htop and see what it does.  It
>     links
>      > to a different version that got pulled down via homebrew in
>      > /usr/local/opt/ncurses/lib (and include respectively)
>      >
>      > Is there a way to force CMake to link to the library found there
>     instead
>      > of in /usr/lib/ ?
>      >
>      > --
>      > Bryan
>      > <><
>      >
>
>     --
>
>     Powered by www.kitware.com <http://www.kitware.com>
>
>     Please keep messages on-topic and check the CMake FAQ at:
>     http://www.cmake.org/Wiki/CMake_FAQ
>
>     Kitware offers various services to support the CMake community. For
>     more information on each offering, please visit:
>
>     CMake Support: http://cmake.org/cmake/help/support.html
>     CMake Consulting: http://cmake.org/cmake/help/consulting.html
>     CMake Training Courses: http://cmake.org/cmake/help/training.html
>
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
>
>     Follow this link to subscribe/unsubscribe:
>     https://cmake.org/mailman/listinfo/cmake
>
>
>
> --
> Bryan
> <><



--
Bryan
<><

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake