eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.37k stars 614 forks source link

Problem building MRAA python docs using latest python-sphinx v1.7.6 package #911

Open b49020 opened 6 years ago

b49020 commented 6 years ago

Hi,

I have Debian buster running on my dragonboard 410c with latest python-sphinx v1.7.6 package installed. Following is sequence of instructions and error message observed:

$ git clone https://github.com/intel-iot-devkit/mraa.git -b v1.9.0
$ cd mraa/
$ mkdir build
$ cd build/
$ cmake .. -DBUILDDOC=ON -DBUILDSWIGPYTHON=ON -DBUILDSWIGNODE=OFF -DINSTALLGPIOTOOL=ON

Error message while configuration:

sphinx-build 1.7.6
CMake Error at src/python/python2/docs/CMakeLists.txt:41 (message):
  ERROR - Failed to find a compatible version of Sphinx.  Python API doc will
  not be generated

-- Configuring incomplete, errors occurred!

Any help regarding above issue is much appreciated.

Regards, Sumit

b49020 commented 6 years ago

It seems that display format of version info changed from sphinx v1.3.5 to v1.7.6 as follows:

$ sphinx-build --version
In case of v1.3.5: "Sphinx (sphinx-build) 1.3.5"
In case of v1.7.6: "sphinx-build 1.7.6"

Due to this parser written in "cmake/modules/FindSphinx.cmake" file doesn't seems to work correctly.

alext-mkrs commented 6 years ago

Thanks @b49020 for reporting this and finding the reason. Are you up to creating a PR to fix this, now that we have the root cause?

b49020 commented 6 years ago

@alext-mkrs Sure I would like to contribute. So I did tried to fix this configuration check for sphinx v1.7.6. But when I try to build MRAA further, I got following error:

/root/mraa/src/python/python2/mraa2.i:6: Error: Unable to find 'common_hpp_doc.i'
/root/mraa/src/python/python2/mraa2.i:7: Error: Unable to find 'gpio_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:8: Error: Unable to find 'i2c_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:9: Error: Unable to find 'pwm_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:10: Error: Unable to find 'aio_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:11: Error: Unable to find 'spi_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:12: Error: Unable to find 'uart_class_doc.i'
src/python/python2/CMakeFiles/gen_python2-mraa_mraa2PYTHON_wrap.dir/build.make:61: recipe for target 'src/python/python2/mraa2PYTHON_wrap.stamp' failed
make[2]: *** [src/python/python2/mraa2PYTHON_wrap.stamp] Error 1
make[2]: *** Deleting file 'src/python/python2/mraa2PYTHON_wrap.stamp'
CMakeFiles/Makefile2:832: recipe for target 'src/python/python2/CMakeFiles/gen_python2-mraa_mraa2PYTHON_wrap.dir/all' failed
make[1]: *** [src/python/python2/CMakeFiles/gen_python2-mraa_mraa2PYTHON_wrap.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Do you have any clue for this build error?

Propanu commented 6 years ago

Maybe caused by %feature("autodoc", "1") which is used to inject documentation strings to the python wrapper?

alext-mkrs commented 6 years ago

I haven't built docs much to be honest, but looking at the CMakeLists.txt and that mraa2.i file in the python2 dir, this looks rather like it's not finding the autogenerated files, which are included if the DOXYGEN define is found. @b49020 could you attach a full log, including the initial CMake run?

b49020 commented 6 years ago

Below is full log:

root@linaro-developer:~/mraa/build# cmake .. -DBUILDDOC=ON \
>           -DBUILDSWIGPYTHON=ON \
>           -DBUILDSWIGNODE=OFF \
>           -DINSTALLGPIOTOOL=ON
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test HAS_C__Wall
-- Performing Test HAS_C__Wall - Success
-- Performing Test HAS_C__Werror_main
-- Performing Test HAS_C__Werror_main - Success
-- Performing Test HAS_C__Wformat
-- Performing Test HAS_C__Wformat - Success
-- Performing Test HAS_C__Wmain
-- Performing Test HAS_C__Wmain - Success
-- Performing Test HAS_C__Wuninitialized
-- Performing Test HAS_C__Wuninitialized - Success
-- Performing Test HAS_C__Winit_self
-- Performing Test HAS_C__Winit_self - Success
-- Performing Test HAS_C__Werror_implicit
-- Performing Test HAS_C__Werror_implicit - Success
-- Performing Test HAS_C__Werror_missing_parameter_type
-- Performing Test HAS_C__Werror_missing_parameter_type - Success
-- Performing Test HAS_CXX__Wall
-- Performing Test HAS_CXX__Wall - Success
-- Performing Test HAS_CXX__Werror_main
-- Performing Test HAS_CXX__Werror_main - Success
-- Performing Test HAS_CXX__Wformat
-- Performing Test HAS_CXX__Wformat - Success
-- Performing Test HAS_CXX__Wmain
-- Performing Test HAS_CXX__Wmain - Success
-- Performing Test HAS_CXX__Wuninitialized
-- Performing Test HAS_CXX__Wuninitialized - Success
-- Performing Test HAS_CXX__Winit_self
-- Performing Test HAS_CXX__Winit_self - Success
-- Performing Test HAS_CXX__Wnon_virtual_dtor
-- Performing Test HAS_CXX__Wnon_virtual_dtor - Success
-- Performing Test HAS_CXX__Woverloaded_virtual
-- Performing Test HAS_CXX__Woverloaded_virtual - Success
-- Performing Test HAS_CXX__Wreorder
-- Performing Test HAS_CXX__Wreorder - Success
-- INFO - libmraa Version v1.9.0
-- INFO - cmake Version 3.11.2
-- INFO - Target arch is armv8
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.15", minimum required is "2.7") 
-- Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython2.7.so (found suitable exact version "2.7.15") 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.4", minimum required is "3") 
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.6.4")
-- Found Doxygen: /usr/bin/doxygen (found suitable version "1.8.13", minimum required is "1.8") found components:  doxygen missing components:  dot
-- INFO - Adding onewire backend support
-- INFO - Adding support for platform ALL
-- INFO - Adding support for all platforms
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
INFO - Adding ARM platforms
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
-- Found SWIG: /usr/bin/swig3.0 (found version "3.0.12") 
-- PYTHON2 attempting to build!
-- Found Sphinx: /usr/bin/sphinx-build (Required is at least version "1.3") 
-- Sphinx version is 1.7.6
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    INSTALLGPIOTOOL

-- Build files have been written to: /root/mraa/build

root@linaro-developer:~/mraa/build# make
Scanning dependencies of target mraa
[  1%] Building C object src/CMakeFiles/mraa.dir/mraa.c.o
[  2%] Building C object src/CMakeFiles/mraa.dir/gpio/gpio.c.o
[  3%] Building C object src/CMakeFiles/mraa.dir/i2c/i2c.c.o
[  4%] Building C object src/CMakeFiles/mraa.dir/pwm/pwm.c.o
[  5%] Building C object src/CMakeFiles/mraa.dir/spi/spi.c.o
[  6%] Building C object src/CMakeFiles/mraa.dir/aio/aio.c.o
[  7%] Building C object src/CMakeFiles/mraa.dir/uart/uart.c.o
[  8%] Building C object src/CMakeFiles/mraa.dir/led/led.c.o
/root/mraa/src/led/led.c: In function 'mraa_led_get_trigfd':
/root/mraa/src/led/led.c:46:33: warning: '%s' directive output may be truncated writing 7 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
     snprintf(buf, MAX_SIZE, "%s/%s", dev->led_path, "trigger");
                                 ^~                  ~~~~~~~~~
/root/mraa/src/led/led.c:46:5: note: 'snprintf' output between 9 and 72 bytes into a destination of size 64
     snprintf(buf, MAX_SIZE, "%s/%s", dev->led_path, "trigger");
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/mraa/src/led/led.c: In function 'mraa_led_get_brightfd':
/root/mraa/src/led/led.c:61:33: warning: '%s' directive output may be truncated writing 10 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
     snprintf(buf, MAX_SIZE, "%s/%s", dev->led_path, "brightness");
                                 ^~                  ~~~~~~~~~~~~
/root/mraa/src/led/led.c:61:5: note: 'snprintf' output between 12 and 75 bytes into a destination of size 64
     snprintf(buf, MAX_SIZE, "%s/%s", dev->led_path, "brightness");
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/mraa/src/led/led.c: In function 'mraa_led_get_maxbrightfd':
/root/mraa/src/led/led.c:76:33: warning: '%s' directive output may be truncated writing 14 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
     snprintf(buf, MAX_SIZE, "%s/%s", dev->led_path, "max_brightness");
                                 ^~                  ~~~~~~~~~~~~~~~~
/root/mraa/src/led/led.c:76:5: note: 'snprintf' output between 16 and 79 bytes into a destination of size 64
     snprintf(buf, MAX_SIZE, "%s/%s", dev->led_path, "max_brightness");
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 10%] Building C object src/CMakeFiles/mraa.dir/grovepi/grovepi.c.o
[ 11%] Building C object src/CMakeFiles/mraa.dir/uart_ow/uart_ow.c.o
[ 12%] Building C object src/CMakeFiles/mraa.dir/iio/iio.c.o
/root/mraa/src/iio/iio.c: In function 'mraa_iio_get_channel_data':
/root/mraa/src/iio/iio.c:40:26: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 71 and 81 [-Wformat-truncation=]
 #define IIO_SYSFS_DEVICE "/sys/bus/iio/devices/" IIO_DEVICE
                          ^
/root/mraa/src/iio/iio.c:113:37: note: in expansion of macro 'IIO_SYSFS_DEVICE'
             snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
                                     ^~~~~~~~~~~~~~~~
/root/mraa/src/iio/iio.c:605:80: note: format string is defined here
      snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
                                                                     ^~
/root/mraa/src/iio/iio.c:113:13: note: 'snprintf' output between 48 and 313 bytes into a destination of size 128
             snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/mraa/src/iio/iio.c: In function 'mraa_iio_get_event_data':
/root/mraa/src/iio/iio.c:40:26: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 78 and 88 [-Wformat-truncation=]
 #define IIO_SYSFS_DEVICE "/sys/bus/iio/devices/" IIO_DEVICE
                          ^
/root/mraa/src/iio/iio.c:409:41: note: in expansion of macro 'IIO_SYSFS_DEVICE'
                 snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_EVENTS "/%s", dev->num, ent->d_name);
                                         ^~~~~~~~~~~~~~~~
/root/mraa/src/iio/iio.c:38:31: note: format string is defined here
 #define IIO_SCAN_ELEM "scan_elements"
                               ^~
/root/mraa/src/iio/iio.c:409:17: note: 'snprintf' output between 41 and 306 bytes into a destination of size 128
                 snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_EVENTS "/%s", dev->num, ent->d_name);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/mraa/src/iio/iio.c: In function 'mraa_iio_update_channels':
/root/mraa/src/iio/iio.c:40:26: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 71 and 81 [-Wformat-truncation=]
 #define IIO_SYSFS_DEVICE "/sys/bus/iio/devices/" IIO_DEVICE
                          ^
/root/mraa/src/iio/iio.c:605:41: note: in expansion of macro 'IIO_SYSFS_DEVICE'
                 snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
                                         ^~~~~~~~~~~~~~~~
/root/mraa/src/iio/iio.c:605:80: note: format string is defined here
      snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
                                                                     ^~
/root/mraa/src/iio/iio.c:605:17: note: 'snprintf' output between 48 and 313 bytes into a destination of size 128
                 snprintf(buf, MAX_SIZE, IIO_SYSFS_DEVICE "%d/" IIO_SCAN_ELEM "/%s", dev->num, ent->d_name);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 13%] Building C object src/CMakeFiles/mraa.dir/json/jsonplatform.c.o
[ 14%] Building C object src/CMakeFiles/mraa.dir/arm/arm.c.o
[ 15%] Building C object src/CMakeFiles/mraa.dir/arm/96boards.c.o
[ 16%] Building C object src/CMakeFiles/mraa.dir/arm/raspberry_pi.c.o
/root/mraa/src/arm/raspberry_pi.c: In function 'mraa_raspberry_pi':
/root/mraa/src/arm/raspberry_pi.c:618:49: warning: '%s' directive writing up to 255 bytes into a region of size 48 [-Wformat-overflow=]
             sprintf(chip_path, "/sys/class/gpio/%s/label", child->d_name);
                                                 ^~
/root/mraa/src/arm/raspberry_pi.c:618:13: note: 'sprintf' output between 23 and 278 bytes into a destination of size 64
             sprintf(chip_path, "/sys/class/gpio/%s/label", child->d_name);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 17%] Building C object src/CMakeFiles/mraa.dir/arm/beaglebone.c.o
/root/mraa/src/arm/beaglebone.c: In function 'mraa_beaglebone':
/root/mraa/src/arm/beaglebone.c:379:18: warning: variable 'uart3_enabled' set but not used [-Wunused-but-set-variable]
     unsigned int uart3_enabled = 0;
                  ^~~~~~~~~~~~~
[ 19%] Building C object src/CMakeFiles/mraa.dir/arm/phyboard.c.o
[ 20%] Building C object src/CMakeFiles/mraa.dir/arm/banana.c.o
[ 21%] Building C object src/CMakeFiles/mraa.dir/arm/de_nano_soc.c.o
[ 22%] Building C object src/CMakeFiles/mraa.dir/version.c.o
[ 23%] Linking C shared library libmraa.so
[ 23%] Built target mraa
Scanning dependencies of target gen_python2-mraa_mraa2PYTHON_wrap
[ 24%] Swig source
/root/mraa/src/python/python2/mraa2.i:6: Error: Unable to find 'common_hpp_doc.i'
/root/mraa/src/python/python2/mraa2.i:7: Error: Unable to find 'gpio_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:8: Error: Unable to find 'i2c_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:9: Error: Unable to find 'pwm_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:10: Error: Unable to find 'aio_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:11: Error: Unable to find 'spi_class_doc.i'
/root/mraa/src/python/python2/mraa2.i:12: Error: Unable to find 'uart_class_doc.i'
src/python/python2/CMakeFiles/gen_python2-mraa_mraa2PYTHON_wrap.dir/build.make:61: recipe for target 'src/python/python2/mraa2PYTHON_wrap.stamp' failed
make[2]: *** [src/python/python2/mraa2PYTHON_wrap.stamp] Error 1
make[2]: *** Deleting file 'src/python/python2/mraa2PYTHON_wrap.stamp'
CMakeFiles/Makefile2:832: recipe for target 'src/python/python2/CMakeFiles/gen_python2-mraa_mraa2PYTHON_wrap.dir/all' failed
make[1]: *** [src/python/python2/CMakeFiles/gen_python2-mraa_mraa2PYTHON_wrap.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
alext-mkrs commented 6 years ago

Hmm, okay - so the log looks generally ok to me, nothing apparently wrong... No further ideas at this point, sorry. Generally the docs are being build-tested in our CI, so there probably is some peculiarity w.r.t. the tool versions you have, but I can't think of anything specific.

Are these files created in the build dir at all, could you check?

pylbert commented 6 years ago

Version of CMake? I believe the latest couple versions change some of the python target generation. Possible that the target dependencies are not creating the .i files prior to the swing call that uses them.

b49020 commented 6 years ago

@pylbert -- INFO - cmake Version 3.11.2

b49020 commented 6 years ago

@alext-mkrs No these *.i files aren't created in build directory.

arfoll commented 6 years ago

Try make the doxygen docs first and make sure you wiped the build/ dir completely, BUILDDOCS is a bit fragile and there may be an order issue somewhere? Also install graphviz to get dot, I'm not sure it'll do much but it's never been tested without.

Try build this target for example: $ make gpioclass_doc_i

You should then get a file in build/src/gpio_class_doc.i

b49020 commented 6 years ago

@arfoll Thanks for the suggestion. It seems to be order/dependency issue only. Using following commands, I am able to build successfully:

$ sudo apt install graphviz
$ cd mraa/
$ mkdir build
$ cd build/
$ cmake .. -DBUILDDOC=ON -DBUILDSWIGPYTHON=ON -DBUILDSWIGNODE=OFF -DINSTALLGPIOTOOL=ON
$ make common_hpp_doc_i
$ make gpioclass_doc_i
$ make i2cclass_doc_i
$ make pwmclass_doc_i
$ make aioclass_doc_i
$ make spiclass_doc_i
$ make uartclass_doc_i
$ make

Do you have any idea to resolve this order issue?