How to handle RPATH issues on Mac OS X when installing cmocka?
I'm trying to install and run a cmocka
unit testing library on Mac OSX Yosemite 10.10.3, but I have some setup issues RPATH
.
Update:
Thanks to @baf, I was able to cmocka.h
manually include in my CMakeLists.txt like this:
set(CMAKE_C_FLAGS_DEBUG "-I/usr/local/include/cmocka.h")
However, why should I do it manually?
I've already tried many different ways to install it:
What I have done so far:
-
Download cmocka from here: here . Version 1.0.
-
tar xvf cmocka-1.0.1.tar.xz
-
cd cmocka-1.0.1
,mkdir build
andcd build
-
sudo cmake ..
I get the message like this:
- Configuration completed
CMake warning (dev):
Policy CMP0042 not set: MACOSX_RPATH is enabled by default. Run "cmake --help-policy CMP0042" for policy details. Use the cmake_policy command to set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following purposes:
cmocka_shared
This is a warning for project developers. Use -Wno-dev to suppress it.
Question # 1: How to set RPATH
so that there are no warnings like above?
-
sudo
make
-
sudo
make install
-
cmocka
should be installed now, right?
Running cmake
for my program that uses the library cmocka
.
So now I run cmake
for my program and my main file CMakeList.txt
has lines like this:
find_library (CMOCKA cmocka)
if (NOT CMOCKA)
message (WARNING "Cmocka library not found.")
endif (NOT CMOCKA)
But the warning does not appear at this point, so I believe I have find_libarary(CMOCKA cmocka)
successfully posted it cmocka
on my computer.
Running make
for my program.
At startup make
, an error like this appears:
fatal error:<br>
'cmocka.h' file not found<br>
#include <cmocka.h>
^
1 error generated.
So, I guess it cmocka
cannot be found ...
Question # 2: Why the library was cmocka
not found?
Additional Notes:
-
I tried to work
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
but it did not help. I think this is a solution for Linux, not Mac.
-
I tried to find out something about
RAPTH
on Maccmake
from their official documentation here: http://www.cmake.org/Wiki/CMake_RPATH_handling . However, I understood very little and I could not find a solution to the problem. -
I tried to install
cmocka
withbrew
but got the same result. -
Also, I read a lot of questions on SO about
RPATH
linking andcmocka
, but I could not find a suitable solution. However, here is a list of related threads: -
I launched
otool -L cmocka
. This is what I got:error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: cmocka (No such file or directory)
source to share