edlins / libPCA9685

superfast PCA9685 library for Debian platforms. developed on Raspbian on a Pi B+.
MIT License
13 stars 8 forks source link

Exclude examples from default make #48

Closed pvint closed 6 years ago

pvint commented 6 years ago

Forgive me if it's already the case and it's a RTFM issue, but I am short on time and wanted to document this:

Compiling on a fresh Pi and getting the following error:

/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~~~~~
/usr/local/src/libPCA9685/examples/PCA9685demo/PCA9685demo.c:10:21: fatal error: ncurses.h: No such file or directory
 #include <ncurses.h>

I will just install ncurses (apt-get install libncurses5-dev) which stops the issue, but I just want the lib and it is only required for the demo.

Cheers! Paul

edlins commented 6 years ago

Ah, it can run in non- ncurses mode but still needs the header to compile. Duh. I'll either leave the demo out of the default compile or #ifdef out the ncurses include. Thanks for the feedback. EDIT: I'll also look into getting rid of the warning.

edlins commented 6 years ago

Just thought of something. You can prob

$ cd libPCA9685/src
$ mkdir build && cd build
$ cmake ..
$ make && sudo make install

Because the lib (src/) has it's own CMakeLists.txt but I think building only the lib should be the default. Better to run a separate make examples.

edlins commented 6 years ago

Okay, #54 merged into develop. This removes examples/ and test/ from the default make. If you want to make test and run the tests, do make PCA9685test && ctest -V. If you want to make quickstart, do make quickstart. Once you've confirmed that your builds are fixed, we can close this issue.

pvint commented 6 years ago

Thanks! But new issue ;) Console history after fresh pull :

  106  rm -fR build/
  107  mkdir build
  108  cd build/
  109  cmake ..
  110  make
  111  make install

Result:

root@uniform /usr/local/src/libPCA9685/build [0]$ make install
[ 25%] Built target PCA9685
[ 50%] Built target quickstart
[ 75%] Built target PCA9685demo
[100%] Built target PCA9685test
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libPCA9685.so
-- Up-to-date: /usr/local/include/PCA9685.h
CMake Error at examples/olaclient/cmake_install.cmake:42 (file):
  file INSTALL cannot find
  "/usr/local/src/libPCA9685/build/examples/olaclient/olaclient".
Call Stack (most recent call first):
  cmake_install.cmake:38 (include)

Makefile:72: recipe for target 'install' failed
make: *** [install] Error 1

As you suggested above:

$ cd libPCA9685/src
$ mkdir build && cd build
$ cmake ..
$ make && sudo make install

This worked like a charm... just have 30 minutes or so to try to do some stuff and wanted a fresh pull of the lib, and I got it... trying not to get distracted on the cmake issue just now ;)

edlins commented 6 years ago

Ah, I think I know what that's about. I made the examples optional in the build but they have mandatory installation rules. I'll look into it before closing this issue.

Related, when I get the netinst sorted out, you'll be able to pull down one file to execute that will perform all of the download, compile, and install steps. So this will get much simpler for the user. "Nobody knew build could be so complicated."

edlins commented 6 years ago

Resolved in #56.

edlins commented 6 years ago

Released in v0.7.