×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Linking libraries on MacOS X

  • Posts: 1957
  • Thank you received: 420
I am trying to create a custom telescope driver on MacOS X. For this I have downloaded the INDI source code and using that (uncompiled) I can make the compilation of my (very simple) driver work without errors. However, when I want to use it, my driver complains about not being able to find the INDI::Telescope class. I have tried to compile the INDI source but I have problems because libnova cannot be found and compilation of libnova fails. So I am wondering if I can link to any library in the /Applications/kstars.app/Contents/MacOS/indi directory and, if yes, which one I should use.
6 years 4 months ago #20911

Please Log in or Create an account to join the conversation.

  • Posts: 1957
  • Thank you received: 420
I managed to build the source on my MacBook thanks to this comment

indilib.org/forum/ekos/525-ekos-on-mac-os-x/11595.html#11598

So now I link to libindidriver.1.dylib but I get this error

Library not loaded: @rpath/libindidriver.1.dylib

I keep on digging :)
6 years 4 months ago #20917

Please Log in or Create an account to join the conversation.

  • Posts: 1957
  • Thank you received: 420
Adding

export LD_LIBRARY_PATH=<directory holding the libindidriver binary file>

solves my issue :)
6 years 4 months ago #20918

Please Log in or Create an account to join the conversation.

  • Posts: 1957
  • Thank you received: 420
... and introduces the next problem:

Symbol not found: _ISGetProperties

The examples compile and run though so I am not sure why this is happening ... yet ;-)
6 years 4 months ago #20919

Please Log in or Create an account to join the conversation.

  • Posts: 1957
  • Thank you received: 420
According to the link.txt file that gets created by cmake when tutorial_two get compiled, these libraries need to be linked:

../../libindidriver.1.6.0.dylib /usr/local/lib/libusb-1.0.dylib /usr/local/lib/libnova.dylib /usr/local/lib/libcfitsio.dylib /usr/lib/libm.dylib /usr/lib/libz.dylib

When I do so my code still doesn't work and I get the "Symbol not found" error. Did I forget any libs?
6 years 4 months ago #20948

Please Log in or Create an account to join the conversation.

  • Posts: 2876
  • Thank you received: 809
Try using our OS X build script. Obviously you don't need to build all of kstars, but the build-env.sh script could be very useful for you in this work you are doing. It will set all the environment variables correctly (hopefully).

github.com/jamiesmith/kstars-on-osx
6 years 4 months ago #20959

Please Log in or Create an account to join the conversation.

  • Posts: 1957
  • Thank you received: 420
It looks like the @rpath is the culprit. otool tells me:

$> otool -L /usr/local/lib/libindidriver.dylib
/usr/local/lib/libindidriver.dylib:
@rpath/libindidriver.1.dylib (compatibility version 1.0.0, current version 1.6.0)
/usr/local/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/local/opt/libnova/lib/libnova-0.15.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/cfitsio/lib/libcfitsio.5.dylib (compatibility version 5.0.0, current version 5.3.42)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)

Thanks very much for the tip. I am not sure if I can use that script but I'll look into it.
6 years 4 months ago #20962

Please Log in or Create an account to join the conversation.

  • Posts: 1957
  • Thank you received: 420
In the end I managed to compile the code using cmake on the command line. Since cmake in my case was installed via Homebrew, I needed to make sure that the dependencies were installed via Homebrew as well. Following the instructions in this tutorialthis tutorial I was able to build all files. The only difference is that I didn't use the -DCMAKE_INSTALL_PREFIX=/usr option to cmake and simply did a "make" instead of a "sudo make install". When cmake was executed it reported for instance that it found these libraries installed from Homebrew:

-- Found CFITSIO 3.42: /usr/local/lib/libcfitsio.dylib
-- Found CFITSIO: /usr/local/lib/libcfitsio.dylib
-- Found NOVA: /usr/local/lib/libnova.dylib
-- Found USB1: /usr/local/Cellar/libusb/1.0.21/lib/libusb-1.0.dylib (found version "1.0.21")
-- Found GSL: /usr/local/Cellar/gsl/2.4/include (found version "2.4")

One issue was a conflicting JPEG library and it turned out the Mac OS X one was used. This only became apparent when compilation succeeded and I tried to use the compiled examples. When I replaced the symlink to point to the Homebrew libjpeg one all went ok. I am happy :)
6 years 1 month ago #23655

Please Log in or Create an account to join the conversation.

Time to create page: 0.209 seconds