Compile issues on Raspberry Pi

  • CreeperCrafter979
    24th Oct 2023 Member 0 Permalink

    I tried following the "Compiling for Linux" section of https://powdertoy.co.uk/Wiki/W/Building_TPT_with_Meson.html in order to get The Powder Toy running on my Raspberry Pi 400 using the old Debian Buster version of Raspberry Pi OS. I saw another post with the same error here, but the suggested fix uses Homebrew which isn't compatible with a Raspberry Pi. The command "meson compile" failed with this text:

     

    pi@raspberrypi:~/Downloads/PowderToy/The-Powder-Toy/build-debug $ meson compile

    INFO: autodetecting backend as ninja

    INFO: calculating backend command to run: /usr/local/bin/ninja

    [22/398] Compiling C++ object powder.p/src_lua_CommandInterface.cpp.o

    In file included from ../src/lua/CommandInterface.cpp:8:

    ../src/gui/game/GameModel.h:155:24: warning: ignoring attributes on template argument ‘ui::Colour’ {aka ‘RGBA<unsigned char, void>’} [-Wignored-attributes]

      std::vector<ui::Colour> GetColourPresets();

                            ^

    [25/398] Compiling C++ object powder.p/src_lua_TPTScriptInterface.cpp.o

    In file included from ../src/lua/TPTScriptInterface.cpp:7:

    ../src/gui/game/GameModel.h:155:24: warning: ignoring attributes on template argument ‘ui::Colour’ {aka ‘RGBA<unsigned char, void>’} [-Wignored-attributes]

      std::vector<ui::Colour> GetColourPresets();

                            ^

    [61/398] Compiling C++ object powder.p/src_client_http_requestmanager_Libcurl.cpp.o

    FAILED: powder.p/src_client_http_requestmanager_Libcurl.cpp.o 

    ccache c++ -Ipowder.p -I. -I.. -Isrc -I../src -Iresources -I../resources -I/usr/include -I/usr/include/libpng16 -I/usr/include/SDL2 -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/usr/include/luajit-2.1 -I/usr/include/arm-linux-gnueabihf -I/usr/include/jsoncpp -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -fno-rtti -O0 -g -D_REENTRANT -pthread -Wno-invalid-offsetof -Wno-unused-result -Wno-missing-field-initializers -Wno-unused-parameter -MD -MQ powder.p/src_client_http_requestmanager_Libcurl.cpp.o -MF powder.p/src_client_http_requestmanager_Libcurl.cpp.o.d -o powder.p/src_client_http_requestmanager_Libcurl.cpp.o -c ../src/client/http/requestmanager/Libcurl.cpp

    ../src/client/http/requestmanager/Libcurl.cpp: In member function ‘void http::RequestManagerImpl::WorkerPerform()’:

    ../src/client/http/requestmanager/Libcurl.cpp:179:19: error: ‘curl_multi_poll’ was not declared in this scope

       HandleCURLMcode(curl_multi_poll(manager->curlMulti, NULL, 0, 1000, &dontcare));

                       ^~~~~~~~~~~~~~~

    ../src/client/http/requestmanager/Libcurl.cpp:179:19: note: suggested alternative: ‘curl_multi_wait’

       HandleCURLMcode(curl_multi_poll(manager->curlMulti, NULL, 0, 1000, &dontcare));

                       ^~~~~~~~~~~~~~~

                       curl_multi_wait

    ../src/client/http/requestmanager/Libcurl.cpp: In member function ‘void http::RequestManager::RegisterRequestImpl(http::Request&)’:

    ../src/client/http/requestmanager/Libcurl.cpp:316:3: error: ‘curl_multi_wakeup’ was not declared in this scope

       curl_multi_wakeup(manager->curlMulti);

       ^~~~~~~~~~~~~~~~~

    ../src/client/http/requestmanager/Libcurl.cpp:316:3: note: suggested alternative: ‘curl_multi_wait’

       curl_multi_wakeup(manager->curlMulti);

       ^~~~~~~~~~~~~~~~~

       curl_multi_wait

    ../src/client/http/requestmanager/Libcurl.cpp: In member function ‘void http::RequestManager::UnregisterRequestImpl(http::Request&)’:

    ../src/client/http/requestmanager/Libcurl.cpp:326:3: error: ‘curl_multi_wakeup’ was not declared in this scope

       curl_multi_wakeup(manager->curlMulti);

       ^~~~~~~~~~~~~~~~~

    ../src/client/http/requestmanager/Libcurl.cpp:326:3: note: suggested alternative: ‘curl_multi_wait’

       curl_multi_wakeup(manager->curlMulti);

       ^~~~~~~~~~~~~~~~~

       curl_multi_wait

    [66/398] Compiling C++ object powder.p/src_debug_ElementPopulation.cpp.o

    ninja: build stopped: subcommand failed.

     

     

    Is there any hope of getting this to work?

    pi@raspberrypi:~/Downloads/PowderToy/The-Powder-Toy/build-debug $ meson compileINFO: autodetecting backend as ninjaINFO: calculating backend command to run: /usr/local/bin/ninja[22/398] Compiling C++ object powder.p/src_lua_CommandInterface.cpp.oIn file included from ../src/lua/CommandInterface.cpp:8:../src/gui/game/GameModel.h:155:24: warning: ignoring attributes on template argument ‘ui::Colour’ {aka ‘RGBA<unsigned char, void>’} [-Wignored-attributes]  std::vector<ui::Colour> GetColourPresets();                        ^[25/398] Compiling C++ object powder.p/src_lua_TPTScriptInterface.cpp.oIn file included from ../src/lua/TPTScriptInterface.cpp:7:../src/gui/game/GameModel.h:155:24: warning: ignoring attributes on template argument ‘ui::Colour’ {aka ‘RGBA<unsigned char, void>’} [-Wignored-attributes]  std::vector<ui::Colour> GetColourPresets();                        ^[61/398] Compiling C++ object powder.p/src_client_http_requestmanager_Libcurl.cpp.oFAILED: powder.p/src_client_http_requestmanager_Libcurl.cpp.o ccache c++ -Ipowder.p -I. -I.. -Isrc -I../src -Iresources -I../resources -I/usr/include -I/usr/include/libpng16 -I/usr/include/SDL2 -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/usr/include/luajit-2.1 -I/usr/include/arm-linux-gnueabihf -I/usr/include/jsoncpp -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -fno-rtti -O0 -g -D_REENTRANT -pthread -Wno-invalid-offsetof -Wno-unused-result -Wno-missing-field-initializers -Wno-unused-parameter -MD -MQ powder.p/src_client_http_requestmanager_Libcurl.cpp.o -MF powder.p/src_client_http_requestmanager_Libcurl.cpp.o.d -o powder.p/src_client_http_requestmanager_Libcurl.cpp.o -c ../src/client/http/requestmanager/Libcurl.cpp../src/client/http/requestmanager/Libcurl.cpp: In member function ‘void http::RequestManagerImpl::WorkerPerform()’:../src/client/http/requestmanager/Libcurl.cpp:179:19: error: ‘curl_multi_poll’ was not declared in this scope   HandleCURLMcode(curl_multi_poll(manager->curlMulti, NULL, 0, 1000, &dontcare));                   ^~~~~~~~~~~~~~~../src/client/http/requestmanager/Libcurl.cpp:179:19: note: suggested alternative: ‘curl_multi_wait’   HandleCURLMcode(curl_multi_poll(manager->curlMulti, NULL, 0, 1000, &dontcare));                   ^~~~~~~~~~~~~~~                   curl_multi_wait../src/client/http/requestmanager/Libcurl.cpp: In member function ‘void http::RequestManager::RegisterRequestImpl(http::Request&)’:../src/client/http/requestmanager/Libcurl.cpp:316:3: error: ‘curl_multi_wakeup’ was not declared in this scope   curl_multi_wakeup(manager->curlMulti);   ^~~~~~~~~~~~~~~~~../src/client/http/requestmanager/Libcurl.cpp:316:3: note: suggested alternative: ‘curl_multi_wait’   curl_multi_wakeup(manager->curlMulti);   ^~~~~~~~~~~~~~~~~   curl_multi_wait../src/client/http/requestmanager/Libcurl.cpp: In member function ‘void http::RequestManager::UnregisterRequestImpl(http::Request&)’:../src/client/http/requestmanager/Libcurl.cpp:326:3: error: ‘curl_multi_wakeup’ was not declared in this scope   curl_multi_wakeup(manager->curlMulti);   ^~~~~~~~~~~~~~~~~../src/client/http/requestmanager/Libcurl.cpp:326:3: note: suggested alternative: ‘curl_multi_wait’   curl_multi_wakeup(manager->curlMulti);   ^~~~~~~~~~~~~~~~~   curl_multi_wait[66/398] Compiling C++ object powder.p/src_debug_ElementPopulation.cpp.oninja: build stopped: subcommand failed.

     
     
    Is there any hope of getting this to work?
  • jacob1
    24th Oct 2023 Developer 0 Permalink
    It looks like you need at least curl v7.0.68 to get the curl_multi_wakeup function.

    That post you found was for macOS, so that won't apply to raspberry pi.

    You may have to get a more upgraded version, if possible you can compile it yourself (I don't have any advice on that right now).
  • LBPHacker
    24th Oct 2023 Developer 0 Permalink
    Can you try the latest commit on master? I just pushed a commit that hopefully brings the required libcurl version down to debian buster levels.
  • CreeperCrafter979
    24th Oct 2023 Member 0 Permalink

    @LBPHacker (View Post)

     This worked and removed the error! Thank you so much!

    I've never been able to compile someone else's program on my computer before, so it was such a relief to see the compile process reach step 398 / 398. However, the linking stage still failed. Seemingly with libcurl again, but for something related to a networking file this time? Can this be fixed too?

     

    pi@raspberrypi:~/Downloads $ git clone https://github.com/The-Powder-Toy/The-Powder-Toy.git
    Cloning into 'The-Powder-Toy'...
    remote: Enumerating objects: 49673, done.
    remote: Counting objects: 100% (4055/4055), done.
    remote: Compressing objects: 100% (1172/1172), done.
    remote: Total 49673 (delta 3126), reused 3543 (delta 2880), pack-reused 45618
    Receiving objects: 100% (49673/49673), 33.64 MiB | 2.33 MiB/s, done.
    Resolving deltas: 100% (38195/38195), done.

    pi@raspberrypi:~/Downloads $ cd The-Powder-Toy/
    pi@raspberrypi:~/Downloads/The-Powder-Toy $ meson setup build-debug
    The Meson build system
    Version: 1.2.3
    Source dir: /home/pi/Downloads/The-Powder-Toy
    Build dir: /home/pi/Downloads/The-Powder-Toy/build-debug
    Build type: native build
    Project name: the-powder-toy
    Project version: the.cake.is.a.lie
    C compiler for the host machine: ccache cc (gcc 8.3.0 "cc (Raspbian 8.3.0-6+rpi1) 8.3.0")
    C linker for the host machine: cc ld.bfd 2.31.1
    C++ compiler for the host machine: ccache c++ (gcc 8.3.0 "c++ (Raspbian 8.3.0-6+rpi1) 8.3.0")
    C++ linker for the host machine: c++ ld.bfd 2.31.1
    Host machine cpu family: arm
    Host machine cpu: armv7l
    Program inkscape skipped: feature render_icons_with_inkscape disabled
    Has header "bzlib.h" : YES
    Library bz2 found: YES
    Found pkg-config: /usr/bin/pkg-config (0.29)
    Run-time dependency luajit found: YES 2.1.0-beta3
    Run-time dependency libcurl found: YES 7.64.0
    Run-time dependency fftw3f found: YES 3.3.8
    Run-time dependency threads found: YES
    Run-time dependency zlib found: YES 1.2.11
    Run-time dependency libpng16 found: YES 1.6.36
    Run-time dependency sdl2 found: YES 2.0.9
    Dependency bzip2 found: YES the.cake.is.a.lie (overridden)
    Run-time dependency jsoncpp found: YES 1.7.4
    Configuring VcsTag.h using configuration
    Configuring ElementNumbers.h using configuration
    Configuring ToolNumbers.h using configuration
    Configuring Config.h using configuration
    Configuring powder.desktop using configuration
    Configuring appdata.xml using configuration
    Build targets in project: 2

    Found ninja-1.11.1.git.kitware.jobserver-1 at /usr/local/bin/ninja
    pi@raspberrypi:~/Downloads/The-Powder-Toy $ cd build-debug/
    pi@raspberrypi:~/Downloads/The-Powder-Toy/build-debug $ meson compile
    INFO: autodetecting backend as ninja
    INFO: calculating backend command to run: /usr/local/bin/ninja

     

    [I cut the warnings so the message is small enough to post]


    [398/398] Linking target powder
    FAILED: powder
    c++ -o powder powder.p/meson-generated_eventcompat.lua.cpp.o powder.p/meson-generated_icon_exe.png.cpp.o powder.p/meson-generated_icon_cps.png.cpp.o powder.p/meson-generated_save.xml.cpp.o powder.p/meson-generated_powder.desktop.cpp.o 

    [Also trimmed]

    powder.p/src_Probability.cpp.o powder.p/src_bson_BSON.cpp.o powder.p/src_bzip2_bz2wrap.cpp.o powder.p/src_common_String.cpp.o powder.p/src_common_tpt-rand.cpp.o powder.p/src_common_tpt-thread-local.cpp.o powder.p/src_common_platform_Common.cpp.o powder.p/src_common_platform_Linux.cpp.o powder.p/src_common_platform_Posix.cpp.o powder.p/src_common_platform_PosixProc.cpp.o powder.p/src_common_platform_ExitCommon.cpp.o -Wl,--as-needed -Wl,--no-undefined -pthread -Wl,--start-group /usr/lib/arm-linux-gnueabihf/libz.so /usr/lib/arm-linux-gnueabihf/libpng16.so /usr/lib/arm-linux-gnueabihf/libSDL2.so /usr/lib/arm-linux-gnueabihf/libluajit-5.1.so /usr/lib/arm-linux-gnueabihf/libcurl.so /usr/lib/arm-linux-gnueabihf/libfftw3f.so /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/libbz2.so /usr/lib/arm-linux-gnueabihf/libjsoncpp.so -Wl,--end-group
    /usr/bin/ld: powder.p/src_client_http_Request.cpp.o: in function `std::__atomic_base<long long>::operator long long() const':
    /usr/include/c++/8/bits/atomic_base.h:396: undefined reference to `__atomic_load_8'
    /usr/bin/ld: powder.p/src_client_http_requestmanager_Libcurl.cpp.o: in function `std::__atomic_base<long long>::operator=(long long)':
    /usr/include/c++/8/bits/atomic_base.h:374: undefined reference to `__atomic_store_8'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

  • jacob1
    25th Oct 2023 Developer 0 Permalink
    @CreeperCrafter979 (View Post)
    Hmm, according to my googling, linking -latomic might fix this issue.

    You can do that by passing this when setting up your meson build site:
    -Dc_link_args=-latomic

    To reconfigure your existing build site with that, use meson setup --reconfigure <buildsite> -Dc_link_args=-latomic
  • CreeperCrafter979
    25th Oct 2023 Member 0 Permalink

    @jacob1 (View Post)

     Unfortunately, linking -latmoic with that command did not fix the issue :/

    Error is the exact same as before.

  • LBPHacker
    25th Oct 2023 Developer 0 Permalink
    Try -Dcpp_link_args=-latomic instead? That fixed it for me, while -Dc_link_args=-latomic didn't.
  • CreeperCrafter979
    25th Oct 2023 Member 0 Permalink

    IT WORKS!!!!

    Thank you all so much! :D

    The performance is slightly worse than my phone, I am using a Raspberry Pi after all, but I like using a mouse much more than a small touchscreen so I think it's great! I'm used to the slow speeds anyway (coughs with being stuck on Blender 2.79) so it doesn't really affect me.

     

    Have an amazing day! Now, excuse me while I go explore an awesome new program I got recently. It has a unique looking electricity system which is just begging me to try making a custom CPU of some sort

  • LBPHacker
    28th Oct 2023 Developer 0 Permalink
    Ah, nice that you got it to work. I may consider adding a more user-accessible workaround (some -Dworkaround_* option like the ones we already have) for this problem, but I don't understand it well enough just yet for that. It has something to do with the raspi versions of lib(std?)c++ not exporting these __atomic_* functions (???), weird.
    Edited once by LBPHacker. Last: 28th Oct 2023