×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Missing C++ compiler error during Pyindi-client installation

  • Posts: 15
  • Thank you received: 0
Hi all,

I am trying to install pyindi-client on my Raspberry Pi 3 following this tuto : indilib.org/support/tutorials/166-instal...on-raspberry-pi.html

I have installed Ubuntu Mate 16.04 on a 64 GB SD card, upgraded all its packages, installed indi-full, everything successfully. But at this step :
pip3 install --user --install-option="--prefix=" pyindi-client
The installation raises an error concerning a missing C++ 2011 compiler.
/usr/lib/python3/dist-packages/pip/commands/install.py:198: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Collecting pyindi-client
  Downloading pyindi-client-0.2.1.tar.gz
Skipping bdist_wheel for pyindi-client, due to binaries being disabled for it.
Installing collected packages: pyindi-client
  Running setup.py install for pyindi-client ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bbgycfcq/pyindi-client/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-59uuj_nv-record/install-record.txt --single-version-externally-managed --compile --prefix= --user --prefix=:
    running install
    running build_ext
    building '_PyIndi' extension
    swigging indiclientpython.i to indiclientpython_wrap.cpp
    swig -python -v -Wall -c++ -threads -I/usr/include -I/usr/include/libindi -o indiclientpython_wrap.cpp indiclientpython.i
    Language subdirectory: python
    Search paths:
       ./
       /usr/include/
       /usr/include/libindi/
       ./swig_lib/python/
       /usr/share/swig3.0/python/
       ./swig_lib/
       /usr/share/swig3.0/
    Preprocessing...
    Starting language-specific parse...
    /usr/include/libindi/baseclient.h:33: Warning 322: Redundant redeclaration of 'MAXRBUF',
    /usr/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
    /usr/include/libindi/baseclient.h:229: Warning 325: Nested struct not currently supported (BLOBMode ignored)
    /usr/include/libindi/basedevice.h:30: Warning 322: Redundant redeclaration of 'MAXRBUF',
    /usr/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
    /usr/include/libindi/baseclient.h:55: Warning 403: Class 'INDI::BaseClient' might be abstract, no constructors generated,
    /usr/include/libindi/indibase.h:78: Warning 403: Method INDI::BaseMediator::newDevice(INDI::BaseDevice *) might not be implemented.
    Processing types...
    C++ analysis...
    Processing nested classes...
    Generating wrappers...
    creating build
    creating build/temp.linux-armv7l-3.5
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include/libindi -I/usr/include/python3.5m -c indiclientpython_wrap.cpp -o build/temp.linux-armv7l-3.5/indiclientpython_wrap.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from /usr/include/c++/5/thread:35:0,
                     from /usr/include/libindi/baseclient.h:27,
                     from indiclientpython_wrap.cpp:3609:
    /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
     #error This file requires compiler and library support \
      ^
    In file included from indiclientpython_wrap.cpp:3609:0:
    /usr/include/libindi/baseclient.h:245:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
         std::thread *listen_thread=nullptr;
         ^
    In file included from /usr/include/libindi/basedevice.h:23:0,
                     from indiclientpython_wrap.cpp:3610:
    /usr/include/libindi/indistandardproperty.h:65:5: warning: identifier ‘constexpr’ is a keyword in C++11 [-Wc++0x-compat]
         static constexpr const char *CONNECTION = "CONNECTION";
         ^
    In file included from indiclientpython_wrap.cpp:3609:0:
    /usr/include/libindi/baseclient.h:245:10: error: ‘thread’ in namespace ‘std’ does not name a type
         std::thread *listen_thread=nullptr;
              ^
    In file included from /usr/include/libindi/basedevice.h:23:0,
                     from indiclientpython_wrap.cpp:3610:
    /usr/include/libindi/indistandardproperty.h:65:12: error: ‘constexpr’ does not name a type
         static constexpr const char *CONNECTION = "CONNECTION";
                ^
    /usr/include/libindi/indistandardproperty.h:65:12: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
    /usr/include/libindi/indistandardproperty.h:72:7: error: expected nested-name-specifier before ‘SP’
     using SP = StandardProperty;
           ^
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
 
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bbgycfcq/pyindi-client/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-59uuj_nv-record/install-record.txt --single-version-externally-managed --compile --prefix= --user --prefix=" failed with error code 1 in /tmp/pip-build-bbgycfcq/pyindi-client/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I have googled the error but my version of GCC and G++ is the 5.4 which natively supports C++ 2011 compilers and since I don't have access to the compilation step, I don't know how to add by default the -std=c++11 or -std=gnu++11 compiler options.

Many thanks for your help !
6 years 8 months ago #18018

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
Hi,
You may try to add an extra_compile_args in the definition of the Extension in the setup.py file
pyindi_module = Extension('_PyIndi',
                          sources=['indiclientpython.i'],
                          language='c++',
                          extra_compile_args='-std=c++11'
                          extra_objects = [join(libindipath, 'libindiclient.a')]
)
and then run directly python3 setup.py install --user.
Maybe language='c++11' does also the trick.
I don't remember if the c++11 porting has been made in indi before or after I made the last update to pyindi-client.
Anyway I will update that when all those big changes will be finished.
6 years 8 months ago #18019

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0
Thank you for your answer !

I have done what you said and I got this after typing python3 setup.py install --user :
running install
running build_ext
building '_PyIndi' extension
swigging indiclientpython.i to indiclientpython_wrap.cpp
swig -python -v -Wall -c++ -threads -I/usr/include -I/usr/include/libindi -o indiclientpython_wrap.cpp indiclientpython.i
Language subdirectory: python
Search paths:
   ./
   /usr/include/
   /usr/include/libindi/
   ./swig_lib/python/
   /usr/share/swig3.0/python/
   ./swig_lib/
   /usr/share/swig3.0/
Preprocessing...
Starting language-specific parse...
/usr/include/libindi/baseclient.h:33: Warning 322: Redundant redeclaration of 'MAXRBUF',
/usr/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
/usr/include/libindi/baseclient.h:229: Warning 325: Nested struct not currently supported (BLOBMode ignored)
/usr/include/libindi/basedevice.h:30: Warning 322: Redundant redeclaration of 'MAXRBUF',
/usr/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
Processing types...
C++ analysis...
/usr/include/libindi/baseclient.h:55: Warning 403: Class 'INDI::BaseClient' might be abstract, no constructors generated,
/usr/include/libindi/indibase.h:78: Warning 403: Method INDI::BaseMediator::newDevice(INDI::BaseDevice *) might not be implemented.
Processing nested classes...
Generating wrappers...
Traceback (most recent call last):
  File "setup.py", line 110, in <module>
    "Topic :: Scientific/Engineering :: Astronomy"
  File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 61, in run
    self.run_command('build_ext')
  File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 49, in run
    _build_ext.run(self)
  File "/usr/lib/python3.5/distutils/command/build_ext.py", line 338, in run
    self.build_extensions()
  File "/usr/lib/python3.5/distutils/command/build_ext.py", line 447, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.5/distutils/command/build_ext.py", line 472, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 174, in build_extension
    _build_ext.build_extension(self, ext)
  File "/usr/lib/python3.5/distutils/command/build_ext.py", line 532, in build_extension
    depends=ext.depends)
  File "/usr/lib/python3.5/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib/python3.5/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
TypeError: can only concatenate list (not "str") to list

Did it work ?

I tried to import PyIndi in Python and it raised an error saying that it doesn't find the module :
Traceback (most recent call last):
  File "/home/clement/pyindi-client-code/pip/pyindi-client/PyIndi.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_PyIndi', [dirname(__file__)])
  File "/usr/lib/python3.5/imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_PyIndi'
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/clement/pyindi-client-code/pip/pyindi-client/PyIndi.py", line 28, in <module>
    _PyIndi = swig_import_helper()
  File "/home/clement/pyindi-client-code/pip/pyindi-client/PyIndi.py", line 20, in swig_import_helper
    import _PyIndi
ImportError: No module named '_PyIndi'

Maybe there is another step.
Last edit: 6 years 8 months ago by Royer.
6 years 8 months ago #18020

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
No it did not work. Actually this extra arg is a Python list (and I also forgot a comma). Try with
pyindi_module = Extension('_PyIndi',
                          sources=['indiclientpython.i'],
                          language='c++',
                          extra_compile_args=[ '-std=c++11'],
                          extra_objects = [join(libindipath, 'libindiclient.a')]
)
6 years 8 months ago #18021

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0
Ok, I have corrected this but I get a new error :
running install
running build_ext
building '_PyIndi' extension
swigging indiclientpython.i to indiclientpython_wrap.cpp
swig -python -v -Wall -c++ -threads -I/usr/include -I/usr/include/libindi -o indiclientpython_wrap.cpp indiclientpython.i
Language subdirectory: python
Search paths:
   ./
   /usr/include/
   /usr/include/libindi/
   ./swig_lib/python/
   /usr/share/swig3.0/python/
   ./swig_lib/
   /usr/share/swig3.0/
Preprocessing...
Starting language-specific parse...
/usr/include/libindi/baseclient.h:33: Warning 322: Redundant redeclaration of 'MAXRBUF',
/usr/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
/usr/include/libindi/baseclient.h:229: Warning 325: Nested struct not currently supported (BLOBMode ignored)
/usr/include/libindi/basedevice.h:30: Warning 322: Redundant redeclaration of 'MAXRBUF',
/usr/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
Processing types...
C++ analysis...
/usr/include/libindi/baseclient.h:55: Warning 403: Class 'INDI::BaseClient' might be abstract, no constructors generated,
/usr/include/libindi/indibase.h:78: Warning 403: Method INDI::BaseMediator::newDevice(INDI::BaseDevice *) might not be implemented.
Processing nested classes...
Generating wrappers...
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include/libindi -I/usr/include/python3.5m -c indiclientpython_wrap.cpp -o build/temp.linux-armv7l-3.5/indiclientpython_wrap.o -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
arm-linux-gnueabihf-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.5/indiclientpython_wrap.o /usr/lib/arm-linux-gnueabihf/libindiclient.a -lz -lcfitsio -lnova -o build/lib.linux-armv7l-3.5/_PyIndi.cpython-35m-arm-linux-gnueabihf.so
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lcfitsio
/usr/bin/ld: cannot find -lnova
collect2: error: ld returned 1 exit status
error: command 'arm-linux-gnueabihf-g++' failed with exit status 1

It seems to be a similar error as the one I have seen on this topic : indilib.org/forum/general/2047-problems-...di.html?limitstart=0
But I don't see how it has been solved.

Thank you again for your help :)
6 years 8 months ago #18033

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
I tested on my desktop fedora 24 and that works.
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include -I/usr/include/libindi -I/usr/include/python3.5m -c indiclientpython_wrap.cpp -o build/temp.linux-x86_64-3.5/indiclientpython_wrap.o
creating build/lib.linux-x86_64-3.5
g++ -pthread -shared -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld build/temp.linux-x86_64-3.5/indiclientpython_wrap.o /usr/lib64/libindiclient.a -L/usr/lib64 -lpython3.5m -lz -lcfitsio -lnova -o build/lib.linux-x86_64-3.5/_PyIndi.cpython-35m-x86_64-linux-gnu.so
running bdist_egg
.....
It seems your compiler does not understand the link command from swig, but the _PyIndi module should be linked against libz, libcfitsio and libnova.
Maybe you could try to force the library search path (the -L option above) in the setup.cfg file:
[build_ext]
swig_opts = -v -Wall -c++ -threads -I/usr/include -I/usr/include/libindi
include_dirs = /usr/include:/usr/include/libindi
libraries = z cfitsio nova
library_dirs = /usr/lib:/usr/lib/arm-linux/gnueabihf
These library_dirs paths depend on your distribution and platform so I let you put the correct values.
Normally the compiler does not need this -L option as it uses defaul value. I tested manually here and in my case - L /usr/lib64 is not needed.
I also notice that there also lacks in your case the -lpython3.5 linker option in the g++ command, so you also may have to add it in the libraries list.
Maybe the swig version you use has some bugs (I use 3.0.8,. I see you have 3.0 in ubuntu mate).
6 years 8 months ago #18038

Please Log in or Create an account to join the conversation.

Regarding INDI Client Library, libnova is no longer required in GIT. So no need to link against it anymore unless you are using it.
6 years 8 months ago #18048

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0
I'm not sure to get what I have to change exactly and why it doesn't work on my Pi. It is a very fresh installation and I just followed the tuto.

My 'setup.cfg' file contains only :
[build_ext]
swig_opts = -v -Wall -c++ -threads -I/usr/include -I/usr/include/libindi
include_dirs = /usr/include:/usr/include/libindi
libraries = z cfitsio nova
library_dirs = /usr/lib:/usr/lib/arm-linux-gnueabihf

And it still not work.

I work on the pyindi-client code files found by :
svn checkout https://svn.code.sf.net/p/pyindi-client/code/trunk ~/pyindi-client-code
6 years 8 months ago #18054

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
Try to locate those libraries:
locate libz.so
locate cifitsio
Remove the (now unuseful) nova in libraries and add the paths found above to library_dirs in the setup.cfg file.
You could try by hand if the compilation has a chance to achieve from the directory where you run the setup script:
arm-linux-gnueabihf-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.5/indiclientpython_wrap.o /usr/lib/arm-linux-gnueabihf/libindiclient.a -L /usr/lib -L /usr/lib/arm-linux-gnueabihf -lz -lcfitsio  -o build/lib.linux-armv7l-3.5/_PyIndi.cpython-35m-arm-linux-gnueabihf.so
Eventually replace /usr/lib and /usr/lib/arm-linux-gnueabihf with the ones you found previously. And there may still miss the -lpython3 flag.
What is strange is that they have made a new version of Ubuntu mate (02/2017) but the tutorial has been made using their previous version and that was working well.
6 years 8 months ago #18055

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0
locate libz.so
/lib/arm-linux-gnueabihf/libz.so.1
/lib/arm-linux-gnueabihf/libz.so.1.2.8
 
locate cfitsio
/usr/lib/arm-linux-gnueabihf/libcfitsio.so.2
/usr/lib/arm-linux-gnueabihf/libcfitsio.so.2.3.37
/usr/share/doc/libcfitsio2
/usr/share/doc/libcfitsio2/changelog.Debian.gz
/usr/share/doc/libcfitsio2/copyright
/var/lib/dpkg/info/libcfitsio2:armhf.list
/var/lib/dpkg/info/libcfitsio2:armhf.md5sums
/var/lib/dpkg/info/libcfitsio2:armhf.postinst
/var/lib/dpkg/info/libcfitsio2:armhf.postrm
/var/lib/dpkg/info/libcfitsio2:armhf.shlibs
/var/lib/dpkg/info/libcfitsio2:armhf.symbols
 

So I have added /lib/arm-linux-gnueabihf to the setup.cfg file but I still have the error about library location.
arm-linux-gnueabihf-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.5/indiclientpython_wrap.o /usr/lib/arm-linux-gnueabihf/libindiclient.a -L /usr/lib -L /usr/lib/arm-linux-gnueabihf -L /lib/arm-linux-gnueabihf -lz -lcfitsio  -o build/lib.linux-armv7l-3.5/_PyIndi.cpython-35m-arm-linux-gnueabihf.so
 
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lcfitsio
collect2: error: ld returned 1 exit status
6 years 8 months ago #18056

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
Ok, there lacks the symbolic links from lib*.so to their current versions:
ln -s /lib/arm-linux-gnueabihf/libz.so.1 /lib/arm-linux-gnueabihf/libz.so
ln -s /usr/lib/arm-linux-gnueabihf/libcfitsio.so.2 /usr/lib/arm-linux-gnueabihf/libcfitsio.so
I think that may be a distribution issue.
Edit: It seems you're not alone, see this thread
The following user(s) said Thank You: Royer
Last edit: 6 years 8 months ago by Jean-Luc.
6 years 8 months ago #18057

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0
It worked :) !

Many thanks for your help !
6 years 8 months ago #18058

Please Log in or Create an account to join the conversation.

Time to create page: 1.288 seconds