artyom-beilis / OpenLiveStacker

Live Stacker Project - C++ backend and frontend
GNU General Public License v3.0
31 stars 3 forks source link

PI Installation #88

Closed 12nucleus closed 2 months ago

12nucleus commented 2 months ago

Anyone has the instructions on how to install OLS on the Raspberry PI? I have a Pi 4, 4Gb but it just refuses to compile properly.

High five to the developer!! I have been using OLS on Android and just love its simplicity, live stacking feature and plate solving to find my targets.

artyom-beilis commented 2 months ago

Yes they are in Read me, pretty straight forward:

https://github.com/artyom-beilis/OpenLiveStacker?tab=readme-ov-file#using-on-linux

I think the only tricky thing that I've seen on Pi is to select correct library in SDK - check if it is 32 or 64 bit.

What problems do you get?

12nucleus commented 2 months ago

My bad. The issue was CppCMS did not compile correctly the first time around. All fine now on this part.

I still a bit fuzzy about the config.json file. If I did the install in '/home/stellarmate/tools/OpenLiveStacker/build' and I am using a touptek camera. I edited the config.json to this:

{ "libdir" : "/home/stellarmate/tools/OpenLiveStacker/build", "driver" : "sim", "sim" : { "path" : "sim" }, "wdir" : { "width" : 3840, "height": 2160, "format" : "raw16", "path" : "/home/stellarmate/tools/OpenLiveStacker/build/wd" }, "toup" : { "oem": false }, "astap" : { "exe": "astap_cli", "db": "/home/stellarmate/tools/OpenLiveStacker/build/data/db" }, "http": { "ip":"0.0.0.0", "port":8080 }

When I run ols and try to go to 0.0.0.0 (I also tried 127.0.0.1) the program crashes with this errors:

./ols_cmd config.json 2024-04-30 19:58:53; cppcms_http, info: GET / (http_api.cpp:294) 2024-04-30 19:58:53; cppcms, error: Catched exception in thread poolInvalid document root 0x7f9c72d0c0: booster::runtime_error::runtime_error(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x50 in /home/stellarmate/tools/OpenLiveStacker/build/libols.so 0x7f9c5c7d10: cppcms::impl::file_server::file_server(cppcms::service&, bool) + 0x1cf0 in /lib/libcppcms.so.2 0x7f9c57d108: cppcms::impl::file_server* cppcms::details::create_app(cppcms::service&) + 0x28 in /lib/libcppcms.so.2 0x7f9c5a574c: cppcms::application_specific_pool::get_new(cppcms::service&) + 0x1c in /lib/libcppcms.so.2 0x7f9c5a6a10: cppcms::application_specific_pool::_pool_policy::get(cppcms::service&) + 0x50 in /lib/libcppcms.so.2 0x7f9c5a41dc: cppcms::application_specific_pool::get(cppcms::service&) + 0x98 in /lib/libcppcms.so.2 0x7f9c5a18b8: cppcms::http::context::dispatch(std::shared_ptr const&, std::shared_ptr const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x38 in /lib/libcppcms.so.2 0x7f9c5a2b30: cppcms::impl::thread_pool::worker() + 0xe0 in /lib/libcppcms.so.2 0x7f9c2be9dc: ??? + 0x9c2be9dc in /lib/aarch64-linux-gnu/libstdc++.so.6 0x7f9c07ee58: ??? + 0x9c07ee58 in /lib/aarch64-linux-gnu/libc.so.6 0x7f9c0e7f9c: ??? + 0x9c0e7f9c in /lib/aarch64-linux-gnu/libc.so.6 (thread_pool.cpp:117) 2024-04-30 19:58:55; cppcms_http, info: GET / (http_api.cpp:294) 2024-04-30 19:58:55; cppcms, error: Catched exception in thread poolInvalid document root 0x7f9c72d0c0: booster::runtime_error::runtime_error(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x50 in /home/stellarmate/tools/OpenLiveStacker/build/libols.so 0x7f9c5c7d10: cppcms::impl::file_server::file_server(cppcms::service&, bool) + 0x1cf0 in /lib/libcppcms.so.2 0x7f9c57d108: cppcms::impl::file_server* cppcms::details::create_app(cppcms::service&) + 0x28 in /lib/libcppcms.so.2 0x7f9c5a574c: cppcms::application_specific_pool::get_new(cppcms::service&) + 0x1c in /lib/libcppcms.so.2 0x7f9c5a6a10: cppcms::application_specific_pool::_pool_policy::get(cppcms::service&) + 0x50 in /lib/libcppcms.so.2 0x7f9c5a41dc: cppcms::application_specific_pool::get(cppcms::service&) + 0x98 in /lib/libcppcms.so.2 0x7f9c5a18b8: cppcms::http::context::dispatch(std::shared_ptr const&, std::shared_ptr const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x38 in /lib/libcppcms.so.2 0x7f9c5a2b30: cppcms::impl::thread_pool::worker() + 0xe0 in /lib/libcppcms.so.2 0x7f9c2be9dc: ??? + 0x9c2be9dc in /lib/aarch64-linux-gnu/libstdc++.so.6 0x7f9c07ee58: ??? + 0x9c07ee58 in /lib/aarch64-linux-gnu/libc.so.6 0x7f9c0e7f9c: ??? + 0x9c0e7f9c in /lib/aarch64-linux-gnu/libc.so.6 (thread_pool.cpp:117) 2024-04-30 19:59:00; cppcms_http, info: GET / (http_api.cpp:294) 2024-04-30 19:59:00; cppcms, error: Catched exception in thread poolInvalid document root 0x7f9c72d0c0: booster::runtime_error::runtime_error(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x50 in /home/stellarmate/tools/OpenLiveStacker/build/libols.so 0x7f9c5c7d10: cppcms::impl::file_server::file_server(cppcms::service&, bool) + 0x1cf0 in /lib/libcppcms.so.2 0x7f9c57d108: cppcms::impl::file_server* cppcms::details::create_app(cppcms::service&) + 0x28 in /lib/libcppcms.so.2 0x7f9c5a574c: cppcms::application_specific_pool::get_new(cppcms::service&) + 0x1c in /lib/libcppcms.so.2 0x7f9c5a6a10: cppcms::application_specific_pool::_pool_policy::get(cppcms::service&) + 0x50 in /lib/libcppcms.so.2 0x7f9c5a41dc: cppcms::application_specific_pool::get(cppcms::service&) + 0x98 in /lib/libcppcms.so.2 0x7f9c5a18b8: cppcms::http::context::dispatch(std::shared_ptr const&, std::shared_ptr const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x38 in /lib/libcppcms.so.2 0x7f9c5a2b30: cppcms::impl::thread_pool::worker() + 0xe0 in /lib/libcppcms.so.2 0x7f9c2be9dc: ??? + 0x9c2be9dc in /lib/aarch64-linux-gnu/libstdc++.so.6 0x7f9c07ee58: ??? + 0x9c07ee58 in /lib/aarch64-linux-gnu/libc.so.6 0x7f9c0e7f9c: ??? + 0x9c0e7f9c in /lib/aarch64-linux-gnu/libc.so.6 (thread_pool.cpp:117)

Is it relate to StellarmateOS or I am doing something wrong?

artyom-beilis commented 2 months ago

Two things

Run ./build/ols_cmd config.json from root directory of the project

2nd to use touptek set driver to value "toup"

artyom-beilis commented 2 months ago

Also note in previous comment:

No Toupcam SDK header/lib found

You need to download touptek SDK and provide path to it as per instructions - make sure you match arch (32 or 64 bit) to the library

12nucleus commented 2 months ago

Made some progress but still have issues with the driver.

I can start OLS if I dont put any driver in the config file. When I add 'toup', OLS says it is looking for libols_driver_toup.so instead of the default driver name in the SDK libtoupcam.so. If I rename the driver to libols_driver_toup.so and run ols, I get this error:

./build/ols_cmd config.json failed:Failed to load driver /home/stellarmate/tools/OpenLiveStacker/build/libols_driver_toup.so: `/home/stellarmate/tools/OpenLiveStacker/build/libols_driver_toup.so: wrong ELF class: ELFCLASS32'

Also, I dont see any arch 32 or 64 bit option in the SDK library, just arm64 armel armhf udev x64 x86.

I tried both the arm64 and armhf driver without success.

My config.json:

{ "libdir" : "/home/stellarmate/tools/OpenLiveStacker/build", "driver" : "toup", "astap" : { "exe": "astap_cli", "db": "/home/stellarmate/tools/OpenLiveStacker/build/data/db" }, "http": { "ip":"0.0.0.0", "port":8080 } }

Thanks a ton for you support!

artyom-beilis commented 2 months ago

OLS says it is looking for libols_driver_toup.so instead of the default driver name in the SDK libtoupcam.s

libols_driver_toup.so is the OLS driver linked to SDK libtoupcam.so.

`/home/stellarmate/tools/OpenLiveStacker/build/libols_driver_toup.so: wrong ELF class: ELFCLASS32'

Please print the output of

ldd build/libols_driver_toup.so

and

file build/libols_driver_toup.so

It looks like something incorrect pointing to LD_LIBRARY_PATH or it loads libtoupcam from incorrect location

12nucleus commented 2 months ago

Ok, maybe this is where things went wrong. There was no libols_driver_toup.so in build/ when I finished compiling the source so I wrongly assume that I needed to copy and rename libtoupcam.so to build/libols_driver_toup.so.

so the question is why build/libols_driver_toup.so is not present...

artyom-beilis commented 2 months ago

I wrongly assume that I needed to copy and rename libtoupcam.so to build/libols_driver_toup.so.

Absolutely... libols_driver_toup.so is part of OpenLiveStacker build. It is linking during the build to libtoupcam.so

You need to add parameters to CMake:

cmake -DCMAKE_INCLUDE_PATH=/path/to/toupteck_sdk/inc -DCMAKE_LIBRARY_PATH=/path/to/toupteck_sdk/linux/arm64 ..

Or if it is 32 bit pi/build than armhf or armel instead arm64 (not sure which one)

Than there should be a message : - Building Toupcam Driver in cmake output

12nucleus commented 2 months ago

Still no go ... I tried arm64, armhf and armel with the same result. I get ' Building Toupcam Driver' with the cmake command but make does not go through.

cmake -DCMAKE_INCLUDE_PATH=/home/stellarmate/Downloads/toupcamsdk/inc -DCMAKE_LIBRARY_PATH=/home/stellarmate/Downloads/toupcamsdk/linux/arm64 .. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /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: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- ASTAP DB Download enabled CPU: aarch64

make [ 3%] Building CXX object CMakeFiles/ols_driver_toup.dir/src/toup_camera.cpp.o /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp: In constructor ‘ols::ToupcamCamera::ToupcamCamera(const std::string&, const std::string&, ols::CamErrorCode&)’: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:112:27: error: ‘Toupcam_query_Model’ was not declared in this scope; did you mean ‘Toupcam_putMode’? 112 | info.model = Toupcam_queryModel(hcam); | ^~~~~~~ | Toupcam_put_Mode /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp: In member function ‘virtual std::vector ols::ToupcamCamera::supported_options(ols::CamErrorCode&)’: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:517:37: error: ‘TOUPCAM_FLAG_HIGHFULLWELL’ was not declared in this scope 517 | if (info.model->flag & TOUPCAM_FLAG_HIGH_FULLWELL) | ^~~~~~ In file included from /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:2: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp: In member function ‘virtual ols::CamParam ols::ToupcamCamera::get_parameter(ols::CamOptionId, bool, ols::CamErrorCode&)’: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:745:59: error: ‘TOUPCAM_OPTION_HIGH_FULLWELL’ was not declared in this scope; did you mean ‘TOUPCAM_OPTION_BLACKLEVEL’? 745 | if (FAILED(hr = Toupcam_getOption(hcam, TOUPCAM_OPTION_HIGH_FULLWELL, &high_fullwell))) | ^~~~~~~~ /home/stellarmate/Downloads/toupcamsdk/inc/toupcam.h:69:37: note: in definition of macro ‘FAILED’ 69 | #define FAILED(hr) (((HRESULT)(hr)) < 0) | ^~ /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp: In member function ‘virtual void ols::ToupcamCamera::set_parameter(ols::CamOptionId, double, ols::CamErrorCode&)’: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:892:48: error: ‘TOUPCAM_OPTION_HIGH_FULLWELL’ was not declared in this scope; did you mean ‘TOUPCAM_OPTION_BLACKLEVEL’? 892 | hr = Toupcam_putOption(hcam, TOUPCAM_OPTION_HIGH_FULLWELL, value ? 1 : 0); | ^~~~~~~~ | TOUPCAM_OPTION_BLACKLEVEL /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp: In member function ‘void ols::ToupcamCamera::init(ols::CamErrorCode&)’: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:1107:39: error: ‘TOUPCAM_FLAG_HIGHFULLWELL’ was not declared in this scope 1107 | if (((info.model->flag & TOUPCAM_FLAG_HIGH_FULLWELL)) && FAILED(hr = Toupcam_putOption(hcam, TOUPCAM_OPTION_HIGH_FULLWELL, 1))) | ^~~~~~ /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:1107:109: error: ‘TOUPCAM_OPTION_HIGH_FULLWELL’ was not declared in this scope; did you mean ‘TOUPCAM_OPTIONBLACKLEVEL’? 1107 | if (((info.model->flag & TOUPCAM_FLAG_HIGH_FULLWELL)) && FAILED(hr = Toupcam_putOption(hcam, TOUPCAM_OPTION_HIGH_FULLWELL, 1))) | ^~~~~~~~ /home/stellarmate/Downloads/toupcamsdk/inc/toupcam.h:69:37: note: in definition of macro ‘FAILED’ 69 | #define FAILED(hr) (((HRESULT)(hr)) < 0) | ^~ /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp: In member function ‘int ols::ToupcamCameraDriver::enumOEM(ToupcamDeviceV2)’: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:1271:33: error: ‘Toupcam_get_Model’ was not declared in this scope; did you mean ‘Toupcam_get_Mode’? 1271 | info[N].model = Toupcam_get_Model(0x547,tp_pid); | ^~~~~ | Toupcam_get_Mode /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp: In function ‘void ols_set_toup_driver_log(const char, int)’: /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:1332:9: error: ‘Toupcam_log_File’ was not declared in this scope; did you mean ‘Toupcam_put_Size’? 1332 | Toupcam_log_File(log_path); | ^~~~ | Toupcam_put_Size /home/stellarmate/OpenLiveStacker/src/toup_camera.cpp:1333:9: error: ‘Toupcam_log_Level’ was not declared in this scope 1333 | Toupcam_log_Level(debug ? 4 : 1); | ^~~~~ make[2]: [CMakeFiles/ols_driver_toup.dir/build.make:76: CMakeFiles/ols_driver_toup.dir/src/toup_camera.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:101: CMakeFiles/ols_driver_toup.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

artyom-beilis commented 2 months ago

Please download latest SDK - it seems you are using outdated SDK

Look here: https://www.touptek-astro.com/downloads/ go to For developers: ToupTek Astronomy camera SDK

12nucleus commented 2 months ago

Wow, that was an ordeal! All working now. This is idiotic, when you google 'touptek sdk', the top result brings you to http://www.touptek.com/ with the older SDK.

Anyway, thanks for your patience and you help.