revelationnow / PlannerPDF

Generate a PDF Planner for the Remarkable Platform
Other
57 stars 12 forks source link

Cmake List for libharu build from source #2

Open AaronDavidSchneider opened 3 years ago

AaronDavidSchneider commented 3 years ago

Hi,

I wanted to test PlannerPDF but failed when trying to make the executable (its not finding hpdf). I successfully installed libharu from source (cmake,make, make install) and its now located in /usr/local/include. I am using OSX.

Here is the error I get when building PlannerPDF:

(base) schneider@Aarons-MacBook-Pro build % cmake ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/schneider/codes/personal/PlannerPDF/build
(base) schneider@Aarons-MacBook-Pro build % make
Scanning dependencies of target Planner_PDF
[ 50%] Building CXX object CMakeFiles/Planner_PDF.dir/src/planner_pdf.cpp.o
In file included from /Users/schneider/codes/personal/PlannerPDF/src/planner_pdf.cpp:32:
In file included from /Users/schneider/codes/personal/PlannerPDF/include/planner_main.hpp:3:
In file included from /Users/schneider/codes/personal/PlannerPDF/include/planner_year.hpp:3:
In file included from /Users/schneider/codes/personal/PlannerPDF/include/planner_month.hpp:1:
In file included from /Users/schneider/codes/personal/PlannerPDF/include/planner_week.hpp:3:
In file included from /Users/schneider/codes/personal/PlannerPDF/include/planner_days.hpp:3:
/Users/schneider/codes/personal/PlannerPDF/include/planner_base.hpp:4:10: fatal error: 'hpdf.h' file not
      found
#include "hpdf.h"
         ^~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/Planner_PDF.dir/src/planner_pdf.cpp.o] Error 1
make[1]: *** [CMakeFiles/Planner_PDF.dir/all] Error 2
make: *** [all] Error 2

Unfortunately I am not really familiar with cmake, so I don't know how I can link the library. Would be glad, if you could help :D

revelationnow commented 3 years ago

The issue you are facing appears to be similar to this It seems cmake on macOS doesn't automatically include some of the standard system include paths like /usr/local/include

Try to see if solutions from here help

AaronDavidSchneider commented 3 years ago

Thanks for your answer! I think one of the solutions in the stack overflow post really helped.

Using

export C_INCLUDE_PATH=/usr/local/include
export CPLUS_INCLUDE_PATH=/usr/local/include

gave

(base) schneider@Aarons-MacBook-Pro build % make
[ 50%] Linking CXX executable Planner_PDF
ld: library not found for -lhpdf
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Planner_PDF] Error 1
make[1]: *** [CMakeFiles/Planner_PDF.dir/all] Error 2
make: *** [all] Error 2

so now I am one step further :D If you have any idea how I could link the library...

revelationnow commented 3 years ago

Try updating LD_LIBRARY_PATH with the path to libhpdf

export LD_LIBRARY_PATH=/usr/local/lib

Typically it isn't good practice to update the LD_LIBRARY_PATH as it can mess with your default configuration and cause undesired behvaiour for other projects if you've forgotten that you have this variable set.

I am not very familiar with the OSX environment, but it might be worth checking out how to make cmake gel well with the system include/link paths specifically for OSX.