Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. need help compiling library...
Forum Update on Monday, May 27th 2025

need help compiling library...

Scheduled Pinned Locked Moved Solved QtonPi
15 Posts 3 Posters 3.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C CharlesHuff

    No problem there...
    here is a link to my mirror site:

    http://briggsassociates.org/src

    sorry that I didn't think to do that earlier!

    Pablo J. RoginaP Offline
    Pablo J. RoginaP Offline
    Pablo J. Rogina
    wrote on last edited by
    #5

    @CharlesHuff I've just unpack the whole Linux_Software.tar into a folder (i.e. sharedlib) and from Qt Creator:

    1. selected New Project / Library / C++ Shared Library
    2. selected the folder sharedlib and click Ok
    3. edited the sharedlib.pro file and added all the required include paths to variable INCLUDEPATH
    4. right click on Sources and selected Add Existing Directories... and chose sFoundation
    5. Remove all the sharedlib.{cpp, h} files added by Qt Creator not needed

    Then I built the library (Ctrl+B) (under Linux x86, not RPi) and I ended up with just 4 warnings:

    /home/pablo/projects/sharedlib/inc/inc-private/linux/tekEventsLinux.h:113: warning: unused parameter ‘lInitialCount’ [-Wunused-parameter]
    CCSemaphore (long lInitialCount = 0,
    ^
    /home/pablo/projects/sharedlib/sFoundation/src-linux/lnkAccessLinux.cpp:312: warning: ordered comparison of pointer with integer zero [-Wextra]
    if ( pfd <= 0 )
    ^
    /home/pablo/projects/sharedlib/sFoundation/src-linux/lnkAccessLinux.cpp:321: warning: ordered comparison of pointer with integer zero [-Wextra]
    if ( fgets(buf, sizeof(buf), pfd) > 0 )
    ^
    /home/pablo/projects/sharedlib/inc/inc-private/linux/tekEventsLinux.h:113: warning: unused parameter ‘lInitialCount’ [-Wunused-parameter]
    CCSemaphore (long lInitialCount = 0,
    ^

    I hope you can replicate this under your RPI board.

    My project file (.pro) just in case:

    QT       -= core gui
    
    TARGET = sharedlib
    TEMPLATE = lib
    
    SOURCES += \
        sFoundation/src/converterLib.cpp \
        sFoundation/src/cpmAPI.cpp \
        sFoundation/src/cpmClassImpl.cpp \
        sFoundation/src/iscAPI.cpp \
        sFoundation/src/lnkAccessCommon.cpp \
        sFoundation/src/meridianNet.cpp \
        sFoundation/src/netCmdAPI.cpp \
        sFoundation/src/netCoreFmt.cpp \
        sFoundation/src/SerialEx.cpp \
        sFoundation/src/sysClassImpl.cpp \
        sFoundation/src-linux/lnkAccessLinux.cpp \
        sFoundation/src-linux/SerialLinux.cpp
    
    INCLUDEPATH += \
        LibINI/inc \
        LibXML/inc \
        LibLinuxOS \
        inc/inc-pub \
        inc/inc-private \
        inc/inc-private/linux \
        inc/inc-private/sFound
    
    
    unix {
        target.path = /usr/lib
        INSTALLS += target
    }
    

    Upvote the answer(s) that helped you solve the issue
    Use "Topic Tools" button to mark your post as Solved
    Add screenshots via postimage.org
    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

    1 Reply Last reply
    1
    • C Offline
      C Offline
      CharlesHuff
      wrote on last edited by
      #6

      Thanks, this was very helpful....

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CharlesHuff
        wrote on last edited by
        #7

        Pablo,
        Step 1,2,3,4 i followed ok. Step 5 didn't see any .h file, so i right clicked on Headers, then add existing directory, navigated to sFoundation, clicked on Parse, then clicked Ok. This step added all the .h files (much faster than typing them in by hand!)
        I still didn't see anything that seemed to be unneeded by QT? I went ahead and did a qmake, clean all, and build all. I got the same 647 warnings as before.
        I installed Qtcreator on the pi itself. Is that why i get warnings? I think the pi is 64 bit, but have read that the Raspbian is still 32 bit? I am using Raspbian Stretch. Should I build the library on Linux Ubuntu? If I do that, will it then work on the Raspbian Stretch? Will it fix the warnings?

        Pablo J. RoginaP 1 Reply Last reply
        0
        • C CharlesHuff

          Pablo,
          Step 1,2,3,4 i followed ok. Step 5 didn't see any .h file, so i right clicked on Headers, then add existing directory, navigated to sFoundation, clicked on Parse, then clicked Ok. This step added all the .h files (much faster than typing them in by hand!)
          I still didn't see anything that seemed to be unneeded by QT? I went ahead and did a qmake, clean all, and build all. I got the same 647 warnings as before.
          I installed Qtcreator on the pi itself. Is that why i get warnings? I think the pi is 64 bit, but have read that the Raspbian is still 32 bit? I am using Raspbian Stretch. Should I build the library on Linux Ubuntu? If I do that, will it then work on the Raspbian Stretch? Will it fix the warnings?

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #8

          @CharlesHuff said in need help compiling library...:

          Step 1,2,3,4 i followed ok.
          Step 5 didn't see any .h file

          if you don't have any .h files by following steps 1-4 something went wrong... Anyway, those steps are not really necessary if you use the .pro file I provided. They were there just to explain how I created such .pro file

          I still didn't see anything that seemed to be unneeded by QT? I went ahead and did a qmake, clean all, and build all. I got the same 647 warnings as before.

          Please try using the provided .pro file. In Ubuntu x64 I've just got only 4 warnings

          I installed Qtcreator on the pi itself. Is that why i get warnings?

          How did you installed Qt Creator on the RPi? Did you build it? or just did apt-get install?

          I think the pi is 64 bit, but have read that the Raspbian is still 32 bit? I am using Raspbian Stretch.

          Raspberry Pi 3 is ARM 64 bit, but Raspbian is just 32 bit as they created just one distribution for all different boards (1, 2, Zero, 3, etc) There are other distributions targeting aarch64 if you like/need that (i.e. Alpine Linux)

          Should I build the library on Linux Ubuntu? If I do that, will it then work on the Raspbian Stretch? Will it fix the warnings?

          If you plan to build the library in Linux Ubuntu you will need to consider doing cross-compile

          Please be aware, that all in all you don't need Qt Creator or Qt framework at all to build this library for ARM architecture.
          However, once you do actually build the library you'll be able to use it in a Qt application via Qt Creator if you like.

          You may want to check this tutorial about Qt Creator for RPi

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1
          • C Offline
            C Offline
            CharlesHuff
            wrote on last edited by
            #9

            @Pablo-J.-Rogina said in need help compiling library...:

            tutorial

            Pablo,
            I have a machine with Ubuntu (not sure how to tell if it's x64)?
            Will the compiled library on Ubuntu work on the Raspberry?
            I installed the Qt creator:
            sudo apt-get install qt5-default
            sudo apt-get install qtcreator
            uninstall a plugin, "Remote Linux" from "About Plugins...", which
            is under "Help" menu
            find "Remote Linux" and you need to uncheck it and restart QtCreator.
            setup the path of gcc and gdb from "Options..." under "Tools" on menu.
            Go to "Build & Run" and click "Tool Chains" tab. Click "Add" and add "GCC".
            Fill out the form: "Compiler path" and "Debugger".
            you can figure it out by a command "whereis gcc, whereis gdb".
            set the path of make from the tab "QtVersions".
            Make sure you see "Desktop" on the bottom after you set the path of "qmake".
            I don't think I need cross compile. I am trying to go the easiest way. My program will be only a couple of screens with buttons.
            Cross compile on Mac does not seem to be possible... but I came closer on Ubuntu. I never really got cross compile to work right so I decided to trade ease of compile for speed and opted to do it all on Raspberry...

            JonBJ 1 Reply Last reply
            0
            • C CharlesHuff

              @Pablo-J.-Rogina said in need help compiling library...:

              tutorial

              Pablo,
              I have a machine with Ubuntu (not sure how to tell if it's x64)?
              Will the compiled library on Ubuntu work on the Raspberry?
              I installed the Qt creator:
              sudo apt-get install qt5-default
              sudo apt-get install qtcreator
              uninstall a plugin, "Remote Linux" from "About Plugins...", which
              is under "Help" menu
              find "Remote Linux" and you need to uncheck it and restart QtCreator.
              setup the path of gcc and gdb from "Options..." under "Tools" on menu.
              Go to "Build & Run" and click "Tool Chains" tab. Click "Add" and add "GCC".
              Fill out the form: "Compiler path" and "Debugger".
              you can figure it out by a command "whereis gcc, whereis gdb".
              set the path of make from the tab "QtVersions".
              Make sure you see "Desktop" on the bottom after you set the path of "qmake".
              I don't think I need cross compile. I am trying to go the easiest way. My program will be only a couple of screens with buttons.
              Cross compile on Mac does not seem to be possible... but I came closer on Ubuntu. I never really got cross compile to work right so I decided to trade ease of compile for speed and opted to do it all on Raspberry...

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #10

              @CharlesHuff

              I have a machine with Ubuntu (not sure how to tell if it's x64)?
              Will the compiled library on Ubuntu work on the Raspberry?

              Umm, I don't think so.

              1 Reply Last reply
              1
              • C Offline
                C Offline
                CharlesHuff
                wrote on last edited by
                #11

                Ignoring the 600 plus warnings seems to work ok. I don't see them when I link the dynamic library into my project (I know they are still there, but it's working).

                Is there a good tutorial that could show me the way to use the axis.h and axis.cpp as a class in Qt Creator? I cannot simply call the functions via signals and slots as I hoped. I guess I need to somehow declare the "SysManager myMgr;" as "global" in scope. sorry I am such a newbie...

                Thanks again Pablo....

                Pablo J. RoginaP 1 Reply Last reply
                0
                • C CharlesHuff

                  Ignoring the 600 plus warnings seems to work ok. I don't see them when I link the dynamic library into my project (I know they are still there, but it's working).

                  Is there a good tutorial that could show me the way to use the axis.h and axis.cpp as a class in Qt Creator? I cannot simply call the functions via signals and slots as I hoped. I guess I need to somehow declare the "SysManager myMgr;" as "global" in scope. sorry I am such a newbie...

                  Thanks again Pablo....

                  Pablo J. RoginaP Offline
                  Pablo J. RoginaP Offline
                  Pablo J. Rogina
                  wrote on last edited by
                  #12

                  @CharlesHuff said in need help compiling library...:

                  , but it's working).
                  ...
                  Is there a good tutorial that could show me the way to use the axis.h and axis.cpp as a class in Qt Creator?

                  Please don't bury a completely different question in this post. If you think this issue is working for you, go and mark the post as solved and then open another post with the question for the chart...

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  1
                  • C Offline
                    C Offline
                    CharlesHuff
                    wrote on last edited by
                    #13

                    Yes Sir, I marked it solved. Many parts of my question are solved and working. I think the warnings are due to the change to Raspberry pi format, but I am not sure of that. Maybe now I can gain enough knowledge to actually use this library...

                    Thank you again.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      CharlesHuff
                      wrote on last edited by
                      #14

                      I followed your instructions to the letter and got the library built on the raspberry... yay!

                      I decided to try to build the same library on linux 'ubuntu' because it's so slow on the raspberry pi 3. I didn't yet get to the cross compile because the library does not compile. Qt gives the same fatal error twice: Ordered comparison between pointer and zero: char * and int.....

                      I am running apt-get update and apt-get upgrade now. Guess I will go back to the raspberry...

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        CharlesHuff
                        wrote on last edited by
                        #15

                        Errors in compile.....
                        MN_EXPORT cnErrCode MN_DECL infcGetHubPorts(std::vectorstd::string &comHubPorts)
                        {
                        comHubPorts.clear();
                        FILE pfd = popen( "ls /dev/ttyXRUSB", "r" );
                        if ( pfd <= 0 )
                        {
                        throw std::runtime_error( "Command or process could not be executed." );
                        }
                        while ( !feof(pfd) )
                        {
                        char buf[ 1024 ] = {0};
                        if ( fgets(buf, sizeof(buf), pfd) > 0 )
                        {
                        std::string str(buf);
                        // TODO: check the VID/PID of the device using udevadm/libudev to
                        // verify that this is a Teknic SC4-Hub (vid=2890, pid=0213)
                        comHubPorts.push_back(str.substr(0, str.length()-1));
                        }
                        }
                        pclose( pfd );
                        return MN_OK;
                        }
                        ERRORS FIXED BY:
                        MN_EXPORT cnErrCode MN_DECL infcGetHubPorts(std::vectorstd::string &comHubPorts)
                        {
                        comHubPorts.clear();
                        FILE pfd = popen( "ls /dev/ttyXRUSB", "r" );
                        if ( !pfd )
                        {
                        throw std::runtime_error( "Command or process could not be executed." );
                        }
                        while ( !feof(pfd) )
                        {
                        char buf[ 1024 ] = {0};
                        if ( fgets(buf, sizeof(buf), pfd) != NULL)
                        {
                        std::string str(buf);
                        // TODO: check the VID/PID of the device using udevadm/libudev to
                        // verify that this is a Teknic SC4-Hub (vid=2890, pid=0213)
                        comHubPorts.push_back(str.substr(0, str.length()-1));
                        }
                        }
                        pclose( pfd );
                        return MN_OK;
                        }
                        If you use this fix, I must warn that I have no idea if it is the CORRECT way to fix the compile error.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved