ld: library not found for -lvtkftgl - macos

I'm trying to compile pcl program and I already done the installation of pcl using homebrew. I'm using Mac OSX 10.10.5 and command line to compile the program. At "make" step I got this error
ld: library not found for -lvtkftgl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
what could be the problems, and possibly solutions. I really appreciated it if anyone help me with this. Thanx in advance.

You can also install the latest PCL version.
brew install --HEAD pcl

So I had this issue as well; seems like the VTK library does not work well with pcl at this moment. A temporary solution is to install pcl without the VTK library, and you can compile and run their tutorial fine.
Run the following:
$ brew uninstall pcl
$ brew install pcl --without-apps --without-tools --without-vtk --without-qt # this will take a while, so be patient here
Now, follow the tutorial here: http://www.pointclouds.org/documentation/tutorials/using_pcl_pcl_config.php#using-pcl-pcl-config
You should be able to compile and run their tutorial fine.

Here is a temporary fix:
brew uninstall pcl
brew install https://raw.githubusercontent.com/ahundt/homebrew-science/vtk6/vtk6.rb --build-from-source
brew install https://raw.githubusercontent.com/ahundt/homebrew-science/vtk6/pcl.rb --build-from-source
Here is a discussion of this particular issue:
https://github.com/mikepurvis/ros-install-osx/issues/32
Here is where I'm trying to submit my fix to homebrew-science. Feel free to encourage them to break the particularly esoteric impasse that's occurring there!
https://github.com/Homebrew/homebrew-science/pull/3512

Related

Mac cmake: 'stdio.h' file not found

I have been stuck on this for a while, and I was wondering if I could get some help.
I'm currently stuck trying to run a cmake setup file and I'm constantly getting this error
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
I've been looking online, and haven't been able to find anything recent. I've tried using the xcode-select --install already.
cmake version is currently 3.21.3.
The library I'm trying to install is https://github.com/google/draco, where I'm trying to install python functions using pybind11. I was able to install this library through cmake, whoever when I try to install the pybind11 functionality I keep getting this error. This library seemed to function properly on a coworkers linux machine, and they were running cmake 3.20.4 on ubuntu 18.04 (I don't know if this makes a difference)
Any help would be appreciated, and please let me know if there's any other information that can help the process.
It looks like something in XCode has changed after updating MacOS to 12.3. I had to reinstall XCode command line tools. I don't say it's right solution, but it works for me.
Commands for reinstalling (from https://stackoverflow.com/a/47804075):
removing the old tools ($ sudo rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).

Ld: library not found for -lcgraph (QT Application)

I am currently working on a QT application, however, I am unable to build due to this error which I am unable to resolve. I am currently using macOS Montery and have already installed xcode command line. I have tried searching online and tried many different solutions but to no avail. Any help or advice would be appreciated thank you!
If you have homebrew installed, try the following:
brew install graphviz

Error installing control v3.0.0 package on El Capitan for Octave

I recently installed Octave using the binary installer found on this site: http://wiki.octave.org/Octave_for_MacOS_X
I then tried to install the control package using 'pkg install -forge control' but it gave me the error 'pkg: error running `make' for the control package.'. I have gone through most of the threads regarding this error but with no success.
I then tried to use MacPorts to install the control package, I followed the instructions on the wiki page above with some help from this thread: Installing general package in octave has error. I believe I succeeded installing the packages because I can see them in the folder tree for Octave and MacPorts says it is installed when using the console.
The problem is that when i run some code in Octave it cannot build as it doesn't know that I have installed any additional packages. Using 'pkg list' in Octave it says that no additional packages installed. I feel like I need to link the two together but I don't know how?
I'll happily explain more if I need to and I hope you can help me out.
Many Thanks,
Sam.
You cannot "link the two together" (assuming you mean the binary version of octave and the MacPorts version).
If you have packages installed via MacPorts for the MacPorts version of octave, then they will only be available from the the MacPorts version of octave, so make sure you are running that.
Otherwise, figure out how to install the package with the octave binary version. It seems you require a build environment for this, but installing the command line tools (which you must have done for MacPorts to work) might have already solved this problem.
It seems to be a problem with gfortan compiler built-in with Octave. To solve this you should install an external fortran compiler.
Try this:
Install Xcode and command line tools for Xcode
Download and install a fortran compiler for MacOS, for example: http://coudert.name/software/gfortran-6.1-ElCapitan.dmg
Change the fortran compiler path in your octave, to this if you installed the compiler that I suggested in point number 2 you only must to open Octave and type: setenv('F77', '/usr/local/gfortran/bin/gfortran').
And Enjoy Octave for MacOS
Octave with control package 3.0.0 on MacOS
You haven't provided enough information for a precise diagnostic, but I had the same error message (and a few more), and re-installing octave from source solved it; see this link for more info, but essentially you can do it by running brew reinstall --build-from-source octave.

libpng not linked on Mac OSX 10.9.2

I installed matrix2png on my Mac and had used it without problem before last week when I installed another image manipulating tool "circos". Circos requires me to install a different version of libpng, and I did. After that, I am no longer able to run matrix2png, which gives me the following error. I think the old ligpnb is not linked any more. Does anyone know how to fix this error? - appreciate your help.
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/bin/matrix2png
Reason: image not found
Those step solve my problem:
brew versions libpng
You will see some versions of libpng, but unfortunately not 1.5.15, so next you should install 1.5.18.
git checkout 7bec702 Library/Formula/libpng.rb
brew install libpng
You'll will find version 1.5.18 and some another versions.
ln -s /usr/local/Cellar/libpng/1.5.18/lib/libpng15.15.dylib /usr/local/lib/libpng15.15.dylib`
See https://github.com/Homebrew/homebrew-php/issues/1055
Some more info on installing certain versions of brew formulas can be found at https://coderwall.com/p/lqphzg.
Your new version of libpng has probably changed the name of its dyld files. This often happens with upgrades (especially following a major release). To verify this, open up the terminal and type:
ls /usr/local/lib/libpng*
What do you see?
From your error message we know that matrix2png is looking for libpng15 but if you've upgraded when instaling circos then you may now have libpng16 on your system. Consequently matrix2png won't be able to find the files that it's looking for and will be unhappy.
Fixing it this time:
Try re-installing matrix2png and see whether it notices the dependency issues and fixes it for you. You don't really want to downgrade libpng nor do you want to have two versions of it on your system, so having an up-to-date version of matrix2png would be good.
It looks like matrix2png comes from C source code, so you'll want to rebuild it. Download the source code or and then open a terminal. Navigate to the folder with the source code and run configure and then make. Configure will generate a Makefile for your system, and then make will use that file to generate a new binary. I've tested this on my Mac (with libpng16), and found that matrix2png built without any errors.
Suggested future approach:
To prevent future linking problems, you may want to use a package manager like homebrew or macports. In case you're using (or want to use) homebrew, it has circos and lib2png (but not matrix2png, sorry!). Once brew is installed, type the following into the terminal:
brew install libpng
And it should detect linking issues / version conflicts and guide you through fixing them. Brew places all of it's files in a 'cellar' location in /usr/local/Cellar and then symbolically links them into your system.
In case you're already using brew, try brew doctor and follow the instructions to resolve problems.
My experience (I've been dealing with a lot of version conflicts in the past few weeks) is that package managers make life much easier. Occasionally I've had to remove and reinstall packages to fix version issues, but in general brew keeps things neat and working.

How can I prevent homebrew from upgrading VTK dependency for PCL?

I would like to install the pcl formula through homebrew, which is documented here:
http://www.pointclouds.org/documentation/tutorials/installing_homebrew.php
Unfortunately, homebrew decides it needs to upgrade my VTK installation to the latest release (6.0) even though I have a perfectly working version (5.10.1) installed already. I would like to compile against and link with this existing version. (The minimum VTK version for pcl is listed as 5.6.1, so everything should work fine. I actually manually build pcl and tried to link it against VTK 6.0, which doesn't even work, yet.)
Therefore, my question is, why does homebrew try to upgrade VTK (to an incompatible version) and how can I prevent it from doing this?
All I am calling is: brew install pcl, which triggers this:
==> Installing pcl dependency: vtk
==> Downloading http://www.vtk.org/files/release/6.0/vtk-6.0.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/vtk-6.0.0.tar.gz
This eventually leads to an error, as vtk 6.0 does not compile under Mac OS X 10.9 through homebrew (https://github.com/Homebrew/homebrew-science/issues/401).
To be clear, even if VTK 6.0 would compile fine, I do not want to upgrade, so does anyone know how to prevent homebrew from upgrading a dependent formula?
You can trick Homebrew to think it has Vtk 6.0 installed. For that you have to run this command in a terminal
ln -s /usr/local/Cellar/vtk/5.10.1 /usr/local/Cellar/vtk/6.0.0
When the time comes for you to really want to update vtk, just eliminate that symlink with
rm /usr/local/Cellar/vtk/6.0.0
and let Homebrew do its job.
Homebrew actually has a formula for vtk5 separately now, so this should now be the correct way to install it (currently it's 5.10.1).
brew install vtk5 --with-qt
You also need eigen, flann, qhull and boost. Also useful, but optional is getting sphinx via pip install sphinx if you want docs. If you want to build simulations (see below option) then you need to get glew too (although it wouldn't find the header).
I can verify that this works on 10.8 and will check 10.9 tonight. I've had problems installing 1.7.1 from the archive, but cloning the github repository worked for me.
$ git clone https://github.com/PointCloudLibrary/pcl pcl-trunk
$ cd pcl_trunk
$ mkdir build; cd build
$ cmake .. -DBUILD_global_tests=ON -DBUILD_examples=ON -DBUILD_simulations=ON
$ ./configure; make; make install
Without VTK you can get to a few % before the PCL install fails. Installing VTK with X11 seems to be a recipe for a disaster here, I had to manually install libX11, libXt and others because VTK was trying to include the incorrect headers. The problems continued with OpenGL and I couldn't compile past around 42%. I reinstalled vtk5 without --with-x11 and it compiled fully.
There is a PCL formula for Homebrew knocking around, but it's rarely updated and I didn't have much luck editing it (not familiar enough with Brew's syntax). I tried to update it and submit a pull request, but when it came to testing the actual 'stable' build fails at the moment so there's no point.
EDIT: To be clear, installing the 1.7.1 tarball fails due to some problem with Eigen (around 12% in when compiling pcl_search).
Proposed pull request, it's a HEAD only fix at the moment.
https://github.com/ros/homebrew-hydro/pull/7
Just downgrade to previous version.
1) cd /usr/local/Library/Taps/homebrew-science/
2) brew versions vtk
3) git checkout 27a4327 vtk.rb
4) brew uninstall vtk && brew install vtk

Resources