Create a temporary directory, which we denote as buildopencv, where you want to put the.
When I compile OpenCV for Mac OSX 10.8 using XCode 4.5.2 and cmake 2.8.9 my installed libraries aren't configured with the correct corresponding installation path.
- The CMake mailing lists mentions that this is not technically foolproof: 'Darwin is the Unix underpinnings of OS X and it is Open Source. I could run a Darwin system and have it NOT be OS X.' Other than APPLE, I couldn't find any strong alternatives.
- CMake is a tool for defining and managing code builds, primarily for C. CMake is a cross-platform tool; the idea is to have a single definition of how the project is built - which translates into specific build definitions for any supported platform.
cmake -G 'Unix Makefiles' -D CMAKE_BUILD_TYPE=RELEASE -D WITH_QT=ON -D WITH_OPENGL=ON -DCMAKE_INSTALL_PREFIX=/opt/local ../opencv.ram/
The CMAKE_INSTALL_PREFIX=/opt/local puts the libraries in the correct place after a 'make install' but the embedded path names are configured with a relative path name such as 'lib/libopencv' and not '/opt/local/lib/libopencv' as desired.
otool -D /opt/local/lib/libopencv_core.2.4.3.dylib/opt/local/lib/libopencv_core.2.4.3.dylib:lib/libopencv_core.2.4.dylib
The libraries in the build location after the make command but before the 'make install' are configured with the correct absolute path name corresponding to the build tree location:
otool -D /Volumes/ramdisk/osx_ffmpeg/lib/libopencv_core.2.4.3.dylib/Volumes/ramdisk/osx_ffmpeg/lib/libopencv_core.2.4.3.dylib:/Volumes/ramdisk/osx_ffmpeg/lib/libopencv_core.2.4.dylib
The relative path seems to be set during installation in the generated cmake_install.cmake file via the install_name_tool command as shown here.
grep -C1 install_name /Volumes/ramdisk/osx_ffmpeg/modules/core/cmake_install.cmake NOT IS_SYMLINK '${file}') EXECUTE_PROCESS(COMMAND '/usr/bin/install_name_tool' -id 'lib/libopencv_core.2.4.dylib'
![Found Found](/uploads/1/2/6/4/126427828/441951110.png)
Basically I'd like to configure the installed libraries with correct embedded absolute path names, so that I can link to them directly without using DYLD_LIBRARY_PATH or the like. Presumably this is the desired default build behavior? Perhaps my build syntax is missing something.
I have found a number of links to folks who have remedied this with post installation scripts using the install_name_tool command to modify the path names, such as shown in the link below, but I'm guessing there is a way to avoid this.
install_name_tool -id
pwd
/opencv/lib/libopencv_core.2.1.dylib opencv/lib/libopencv_core.2.1.dylibIf I omit the CMAKE_INSTALL_PREFIX=/opt/local cmake option the libraries are installed in the default /usr/local/lib location but still have a relative embedded path name.
UPDATE: I haven't found a cmake fix for this but did create a simpler post installation bash script that should fix the install path for opencv libraries and their dependencies:
editretagflag offensiveclosemergedelete
![Cmake for mac os Cmake for mac os](/uploads/1/2/6/4/126427828/961277966.png)
Comments
I'm running into the same issue with Qt5 and macdeployqt, which complains about wrong paths (the relative ones mentioned above) to the opencv .dylib. Any update on this? None of the proposed solution here solved the problem. The relative paths are:lib/libopencv_core.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)lib/libopencv_highgui.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)lib/libopencv_imgproc.3.0.dylib (compatibility version 3.0.0, current version 3.0.0)
A simple solution is
cmake -D BUILD_SHARED_LIBS=OFF
. Static libraries do not use relative path.Unlike the software developed for Windows system, most of the applications installed in Mac OS X generally can be removed with relative ease. CMake 3.2.2 is a third party application that provides additional functionality to OS X system and enjoys a popularity among Mac users. However, instead of installing it by dragging its icon to the Application folder, uninstalling CMake 3.2.2 may need you to do more than a simple drag-and-drop to the Trash.
Download Mac App RemoverWhen installed, CMake 3.2.2 creates files in several locations. Generally, its additional files, such as preference files and application support files, still remains on the hard drive after you delete CMake 3.2.2 from the Application folder, in case that the next time you decide to reinstall it, the settings of this program still be kept. But if you are trying to uninstall CMake 3.2.2 in full and free up your disk space, removing all its components is highly necessary. Continue reading this article to learn about the proper methods for uninstalling CMake 3.2.2.
Manually uninstall CMake 3.2.2 step by step:
Most applications in Mac OS X are bundles that contain all, or at least most, of the files needed to run the application, that is to say, they are self-contained. Thus, different from the program uninstall method of using the control panel in Windows, Mac users can easily drag any unwanted application to the Trash and then the removal process is started. Despite that, you should also be aware that removing an unbundled application by moving it into the Trash leave behind some of its components on your Mac. To fully get rid of CMake 3.2.2 from your Mac, you can manually follow these steps:
1. Terminate CMake 3.2.2 process(es) via Activity Monitor
Before uninstalling CMake 3.2.2, you’d better quit this application and end all its processes. If CMake 3.2.2 is frozen, you can press Cmd +Opt + Esc, select CMake 3.2.2 in the pop-up windows and click Force Quit to quit this program (this shortcut for force quit works for the application that appears but not for its hidden processes).
Open Activity Monitor in the Utilities folder in Launchpad, and select All Processes on the drop-down menu at the top of the window. Select the process(es) associated with CMake 3.2.2 in the list, click Quit Process icon in the left corner of the window, and click Quit in the pop-up dialog box (if that doesn’t work, then try Force Quit).
2. Delete CMake 3.2.2 application using the Trash
First of all, make sure to log into your Mac with an administrator account, or you will be asked for a password when you try to delete something.
Open the Applications folder in the Finder (if it doesn’t appear in the sidebar, go to the Menu Bar, open the “Go” menu, and select Applications in the list), search for CMake 3.2.2 application by typing its name in the search field, and then drag it to the Trash (in the dock) to begin the uninstall process. Alternatively you can also click on the CMake 3.2.2 icon/folder and move it to the Trash by pressing Cmd + Del or choosing the File and Move to Trash commands.
For the applications that are installed from the App Store, you can simply go to the Launchpad, search for the application, click and hold its icon with your mouse button (or hold down the Option key), then the icon will wiggle and show the “X” in its left upper corner. Click the “X” and click Delete in the confirmation dialog.
Download Mac App Remover3. Remove all components related to CMake 3.2.2 in Finder
Though CMake 3.2.2 has been deleted to the Trash, its lingering files, logs, caches and other miscellaneous contents may stay on the hard disk. For complete removal of CMake 3.2.2, you can manually detect and clean out all components associated with this application. You can search for the relevant names using Spotlight. Those preference files of CMake 3.2.2 can be found in the Preferences folder within your user’s library folder (~/Library/Preferences) or the system-wide Library located at the root of the system volume (/Library/Preferences/), while the support files are located in '~/Library/Application Support/' or '/Library/Application Support/'.
Open the Finder, go to the Menu Bar, open the “Go” menu, select the entry:|Go to Folder... and then enter the path of the Application Support folder:~/Library
Search for any files or folders with the program’s name or developer’s name in the ~/Library/Preferences/, ~/Library/Application Support/ and ~/Library/Caches/ folders. Right click on those items and click Move to Trash to delete them.
Meanwhile, search for the following locations to delete associated items:
- /Library/Preferences/
- /Library/Application Support/
- /Library/Caches/
Besides, there may be some kernel extensions or hidden files that are not obvious to find. In that case, you can do a Google search about the components for CMake 3.2.2. Usually kernel extensions are located in in /System/Library/Extensions and end with the extension .kext, while hidden files are mostly located in your home folder. You can use Terminal (inside Applications/Utilities) to list the contents of the directory in question and delete the offending item.
4. Empty the Trash to fully remove CMake 3.2.2
If you are determined to delete CMake 3.2.2 permanently, the last thing you need to do is emptying the Trash. To completely empty your trash can, you can right click on the Trash in the dock and choose Empty Trash, or simply choose Empty Trash under the Finder menu (Notice: you can not undo this act, so make sure that you haven’t mistakenly deleted anything before doing this act. If you change your mind, before emptying the Trash, you can right click on the items in the Trash and choose Put Back in the list). In case you cannot empty the Trash, reboot your Mac.
Download Mac App RemoverTips for the app with default uninstall utility:
You may not notice that, there are a few of Mac applications that come with dedicated uninstallation programs. Though the method mentioned above can solve the most app uninstall problems, you can still go for its installation disk or the application folder or package to check if the app has its own uninstaller first. If so, just run such an app and follow the prompts to uninstall properly. After that, search for related files to make sure if the app and its additional files are fully deleted from your Mac.
Automatically uninstall CMake 3.2.2 with MacRemover (recommended):
No doubt that uninstalling programs in Mac system has been much simpler than in Windows system. But it still may seem a little tedious and time-consuming for those OS X beginners to manually remove CMake 3.2.2 and totally clean out all its remnants. Why not try an easier and faster way to thoroughly remove it?
If you intend to save your time and energy in uninstalling CMake 3.2.2, or you encounter some specific problems in deleting it to the Trash, or even you are not sure which files or folders belong to CMake 3.2.2, you can turn to a professional third-party uninstaller to resolve troubles. Here MacRemover is recommended for you to accomplish CMake 3.2.2 uninstall within three simple steps. MacRemover is a lite but powerful uninstaller utility that helps you thoroughly remove unwanted, corrupted or incompatible apps from your Mac. Now let’s see how it works to complete CMake 3.2.2 removal task.
1. Download MacRemover and install it by dragging its icon to the application folder.
2. Launch MacRemover in the dock or Launchpad, select CMake 3.2.2 appearing on the interface, and click Run Analysis button to proceed.
3. Review CMake 3.2.2 files or folders, click Complete Uninstall button and then click Yes in the pup-up dialog box to confirm CMake 3.2.2 removal.
Mac Cmake Install
The whole uninstall process may takes even less than one minute to finish, and then all items associated with CMake 3.2.2 has been successfully removed from your Mac!
Cmake Tutorial
Benefits of using MacRemover:
MacRemover has a friendly and simply interface and even the first-time users can easily operate any unwanted program uninstallation. With its unique Smart Analytic System, MacRemover is capable of quickly locating every associated components of CMake 3.2.2 and safely deleting them within a few clicks. Thoroughly uninstalling CMake 3.2.2 from your mac with MacRemover becomes incredibly straightforward and speedy, right? You don’t need to check the Library or manually remove its additional files. Actually, all you need to do is a select-and-delete move. As MacRemover comes in handy to all those who want to get rid of any unwanted programs without any hassle, you’re welcome to download it and enjoy the excellent user experience right now!
This article provides you two methods (both manually and automatically) to properly and quickly uninstall CMake 3.2.2, and either of them works for most of the apps on your Mac. If you confront any difficulty in uninstalling any unwanted application/software, don’t hesitate to apply this automatic tool and resolve your troubles.