jvm-profiling-tools / honest-profiler

A sampling JVM profiler without the safepoint sample bias
https://github.com/RichardWarburton/honest-profiler/wiki
MIT License
1.25k stars 146 forks source link

Build failed on OSX #248

Open MichaelScofield opened 6 years ago

MichaelScofield commented 6 years ago

I'm trying to build honest-profiler on my OSX. I have already installed cmake, unittest++ and pkgconfig via Homebrew:

brew install cmake
brew install unittest-cpp
brew install pkgconfig

When I execute cmake CMakeLists.txt, it shows an errorr:

-- The C compiler identification is AppleClang 10.0.0.10001025
-- The CXX compiler identification is AppleClang 10.0.0.10001025
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") 
-- Found JNI: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/libjawt.dylib  
CMake Error at CMakeLists.txt:38 (find_package):
  Could not find a package configuration file provided by "UnitTest++" with
  any of the following names:

    UnitTest++Config.cmake
    unittest++-config.cmake

  Add the installation prefix of "UnitTest++" to CMAKE_PREFIX_PATH or set
  "UnitTest++_DIR" to a directory containing one of the above files.  If
  "UnitTest++" provides a separate development package or SDK, be sure it has
  been installed.

-- Configuring incomplete, errors occurred!
See also "/Users/me/repo/git/honest-profiler/CMakeFiles/CMakeOutput.log".

What can I do with the error?

itchanges commented 6 years ago

edit CMakeLists.txt, find this line then remove -- find_package(UnitTest++ REQUIRED NO_MODULE)

snowe2010 commented 6 years ago

@itchanges since you seem to know what to do regarding OSX, can you explain why all the steps succeed for me, but I don't have any .so file in the zip folder?

❯ unzip target/honest-profiler.zip
Archive:  target/honest-profiler.zip
  inflating: console
  inflating: dump-flamegraph
  inflating: gui
  inflating: honest-profiler.jar
  inflating: liblagent.dylib
hamiltron commented 5 years ago

In case anyone else comes across this ... libagent.dylib is the macOS equivalent of the .so file. If you specify this file for -agentpath, it should work.

snowe2010 commented 5 years ago

oops. yes. I forgot to update this issue after figuring that out. Thank you @hamiltron

hlzhang commented 5 years ago

Failed on OSX 10.14.3, xcode 10.2, cmake 3.14.0, openjdk-11.0.2

-- The C compiler identification is AppleClang 10.0.1.10010046 -- The CXX compiler identification is AppleClang 10.0.1.10010046 -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") -- Found JNI: /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/lib/libjawt.dylib CMake Error at CMakeLists.txt:54 (get_filename_component): get_filename_component unknown component /usr/local/include/UnitTest++/UnitTest++.h

-- Detected 64 bit Mac -- using Clang -- Configuring incomplete, errors occurred!

jeschkies commented 4 years ago

I have the same issue. When I hard code the path to the unittest++ headers it fails later while linking unittest++. Ideally one could compile it without it.