×

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

Bi-monthly release with minor bug fixes and improvements

can't compile baseclient.cpp

  • Posts: 137
  • Thank you received: 97
Hi!

today I wanted to compile the baseclient github.com/indilib/indi/blob/master/libs...ibase/baseclient.cpp to make a .so to embed in another code. It seems I can't get it to compile as I get these errors:
In file included from /home/matt/data/indi/indi/libs/indibase/baseclient.h:23,
                 from /home/matt/data/indi/indi/libs/indibase/baseclient.cpp:21:
/home/matt/data/indi/indi/libs/indibase/indibase.h:80:13: note: previous definition of ‘class INDI::BaseMediator’
   80 | class INDI::BaseMediator
      |             ^~~~~~~~~~~~
In file included from /home/matt/data/indi/indi/libs/indibase/indiutility.h:29,
                 from /home/matt/data/indi/indi/libs/indibase/basedevice.h:23,
                 from /home/matt/data/indi/indi/libs/indibase/baseclient.cpp:25:
/home/matt/data/indi/indi/libs/indibase/indimacros.h:104:18: error: redefinition of ‘template<class T> T* getPtrHelper(T*)’
  104 | static inline T *getPtrHelper(T *ptr) { return ptr; }
      |                  ^~~~~~~~~~~~
 

I am not sure if this is the correct way, but looking at pyindi it seems to me it does something very similar to create the package. I also looked through my entire filesystem and I couldn't find any trace of such a shared object (but there is a libindiclient.a) how can I achieve my goal?
2 years 8 months ago #73713

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

How are you including it? using cmake? If you provide a sample, we can probably help.
2 years 8 months ago #73842

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

  • Posts: 137
  • Thank you received: 97

Replied by Mattia on topic can't compile baseclient.cpp

I am using the following command with g++
g++ -w -c -fPIC -I /usr/include/libindi/ -I /home/matt/data/indi/indi/ -I /home/matt/data/indi/indi/libs/ /home/matt/data/indi/indi/libs/indibase/baseclient.cpp -o ./indiclient.o
2 years 8 months ago #73922

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

The client depends on a lot of sources. Look at CMakeListst.txt for example:
SET(indiclient_C_SRC
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/lilxml.c
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/userio.c
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indiuserio.c
    ${CMAKE_CURRENT_SOURCE_DIR}/base64.c)
 
SET(indiclient_CXX_SRC
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/libastro.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/basedevice.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/baseclient.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indiproperty.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indiproperties.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indipropertybasic.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indipropertytext.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indipropertynumber.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indipropertyswitch.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indipropertylight.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indipropertyblob.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/property/indipropertyview_client.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase/indistandardproperty.cpp)

You can use CMake to locate INDI and link your application to the client library. For example,

find_package(INDI REQUIRED)
find_package(Nova REQUIRED)
target_link_libraries(myapp ${INDI_CLIENT_LIBRARIES} ${NOVA_LIBRARIES})
The following user(s) said Thank You: Mattia
2 years 8 months ago #73932

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

  • Posts: 137
  • Thank you received: 97

Replied by Mattia on topic can't compile baseclient.cpp

thanks for your input Jasem! with a bit of magic I was able to compile a .so!
2 years 8 months ago #73956

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

Time to create page: 0.635 seconds