Open zhovner opened 5 years ago
hey @zhovner , I don't have a Mac to test this on, but the CI seems to work just fine on OSX. The dependencies are installed according to this script, https://github.com/insomniacslk/dublin-traceroute/blob/master/.travis/install_dependencies_osx.sh . Can you try to run these commands first, then retry the brew install dublin-traceroute.rb ?
Also, which version of OSX are you on?
Meanwhile I'll add this test to the CI as well.
CI seems to work just fine on OSX
What is CI?
The dependencies are installed according to this script
All dependencies are already installed by homebrew formula and I have jsoncpp
package installed:
$ ls -la /usr/local/include/json/
total 184
drwxr-xr-x 13 a staff 416 Jul 12 00:38 .
drwxr-xr-x 3 a staff 96 Jul 12 00:38 ..
-rw-r--r-- 1 a staff 2499 Jul 12 00:38 allocator.h
-rw-r--r-- 1 a staff 2643 Jul 12 00:38 assertions.h
-rw-r--r-- 1 a staff 686 Jul 12 00:38 autolink.h
-rw-r--r-- 1 a staff 6226 Jul 12 00:38 config.h
-rw-r--r-- 1 a staff 1811 Jul 12 00:38 features.h
-rw-r--r-- 1 a staff 912 Jul 12 00:38 forwards.h
-rw-r--r-- 1 a staff 444 Jul 12 00:38 json.h
-rw-r--r-- 1 a staff 13801 Jul 12 00:38 reader.h
-rw-r--r-- 1 a staff 28422 Jul 12 00:38 value.h
-rw-r--r-- 1 a staff 815 Jul 12 00:38 version.h
-rw-r--r-- 1 a staff 12142 Jul 12 00:38 writer.h
and pkg file:
ls -la /usr/local/lib/pkgconfig/jsoncpp.pc
/usr/local/lib/pkgconfig/jsoncpp.pc -> ../../Cellar/jsoncpp/1.9.1/lib/pkgconfig/jsoncpp.pc
It's all symlinked to this jsoncpp
package files:
$ brew list jsoncpp
/usr/local/Cellar/jsoncpp/1.9.1/include/json/ (11 files)
/usr/local/Cellar/jsoncpp/1.9.1/lib/libjsoncpp.1.9.0.dylib
/usr/local/Cellar/jsoncpp/1.9.1/lib/cmake/ (3 files)
/usr/local/Cellar/jsoncpp/1.9.1/lib/pkgconfig/jsoncpp.pc
/usr/local/Cellar/jsoncpp/1.9.1/lib/ (2 other files)
I'm using latest macOS Mojave 10.14.6 (18G87) and latest packages from brew.
What's the output of pkg-config --libs --cflags jsoncpp
?
I wonder if PKG_CONFIG_PATH is pointing to the correct location. According to https://linux.die.net/man/1/pkg-config :
PKG_CONFIG_PATH
A colon-separated (on Windows, semicolon-separated)
list of directories to search for .pc files. The default
directory will always be searched after searching
the path; the default is libdir/pkgconfig:datadir/pkgconfig
where libdir is the libdir where pkg-config and datadir
is the datadir where pkg-config was installed
CI seems to work just fine on OSX
What is CI?
Continuous Integration, the automation that I use to build and test dublin-traceroute on linux and osx at every commit
What's the output of pkg-config --libs --cflags jsoncpp?
-I/usr/local/Cellar/jsoncpp/1.9.1/include -L/usr/local/Cellar/jsoncpp/1.9.1/lib -ljsoncpp
I'm struggling to reproduce the issue here, and I won't have access to a macOS device before next week (because of holidays abroad).
Meanwhile I'm trying to understand from the cmake documentation what could be failing to find the package via pkg-config
FYI the PR where I'm trying to reproduce the issue is https://github.com/insomniacslk/dublin-traceroute/pull/64
Hi there, I have the same issue (macOS version is the same as well). In case any check on my side could be done to speed up the fixation, just let me know. Thanks.
Hello. I've experienced the same issue. I had to fix it by setting LIBRARY_PATH
. Before:
$ make
[ 75%] Built target dublintraceroute
[ 87%] Linking CXX executable dublin-traceroute
ld: library not found for -ljsoncpp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [dublin-traceroute] Error 1
make[1]: *** [CMakeFiles/dublin-traceroute.dir/all] Error 2
make: *** [all] Error 2
After:
$ LIBRARY_PATH=/usr/local/opt/jsoncpp/lib make
[ 75%] Built target dublintraceroute
[ 87%] Linking CXX executable dublin-traceroute
[100%] Built target dublin-traceroute
Hi I am not a user of this project however I came across this exact same issue. I couldn't find this in the JsonCPP project documentation but the fix for me was to use ${JSONCPP_LINK_LIBRARIES} in target_link_libraries in CMakeLists.txt. E.g:
cmake_minimum_required(VERSION 3.22)
set(CMAKE_CXX_STANDARD 11)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSONCPP jsoncpp)
add_executable(utils main.cpp)
target_link_libraries(
utils
${JSONCPP_LINK_LIBRARIES}
)
This is what I had to do for Apple Silicon since homebrew is installed to /opt/homebrew, not /usr/local.
sed -i txt 's#/usr/local#/opt/homebrew#' CMakeLists.txt
mkdir build ; cd build
cmake ..
LIBRARY_PATH=/opt/homebrew/opt/jsoncpp/lib make
CMakeLists.txt requires a lot of rework to compile on modern platforms, I'll take a look at it when I have time, but I'm happy to review a PR if someone is willing to do that
LIBRARY_PATH=/opt/homebrew/opt/jsoncpp/lib
If you don't have a standard homebrew
installation path, just replace /opt/homebrew/opt
with the output of brew --prefix jsoncpp
I've try to build it using brew formula
brew install https://raw.githubusercontent.com/insomniacslk/dublin-traceroute/master/homebrew/dublin-traceroute.rb
and get this error:
Package jsoncpp is installed. Probably you have
jsoncpp-devel
instelled on your system?