1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice

Pandora Need Help Compiling DrawPile - Codeblocks.pnd - Qt

Discussion in 'C /C ++' started by kuru, Jan 20, 2017.

  1. kuru

    kuru Irate Pyrate

    Joined:
    Jan 13, 2009
    Messages:
    1,390
    Location:
    .de
    I'm trying to compile the latest Drawpile. After working out dependencies in baby steps, make now fails complaining over the prototype of a Qt function qBound

    The code looks like this:
    Code:
    void KisCubicCurve::fromString(const QString& string)
    {
        QStringList data = string.split(';');
    
        QList<QPointF> points;
    
        foreach(const QString & pair, data) {
            if (pair.indexOf(',') > -1) {
                QPointF p;
                p.rx() = qBound(0.0, pair.section(',', 0, 0).toDouble(), 1.0);
                p.ry() = qBound(0.0, pair.section(',', 1, 1).toDouble(), 1.0);
                points.append(p);
            }
        }
    
       if(points.size() < 2)
           points = { {0.0, 0.0}, {1.0, 1.0} };
    
        setPoints(points);
    }
    I guess that the problem is caused by different data types for the arguments of that qBound() function and how it is called in the above snippet. Am I interpreting the Qt example page linked above correctly? Is the implementation just wrong? What's the proper way to go about fixing things from here on out? Maybe it's best to talk to the Drawpile authors first?
    I'm all ears for your suggestions.
     
    Tags:
    ible likes this.
  2. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,183
    Location:
    France, near Lyon
    I you are using "-fsingle-precision-constant" (it's by default in codeblocks command line), the constant are transofrmed to float, so the template resolution is confuse as you are mixing double and float (wich template take? the double or the float?).

    So you have 2 solutions:
    1. remove -fsingle-precision-constant from the flag, or, more easy perhaps, add -fno-single-precision-constant to the flags.
    2. define wich template you want. use for example "qBound<float>(0.0, pair.section...."

    Solution 1 is the easiest to do. You will loose the speed benefit of the float math vs double on Pandora (it counts!), but it's 1 change to make it compile, and if your software is doing precise math, you may want to do that (in that case, also use -fno-fast-math). Solution 2 can be tedious (same compile error with std::min, so you may have to do a lot of changes in the code).
     
    kuru likes this.
  3. ible

    ible Advanced Guard Tower

    Joined:
    Mar 24, 2014
    Messages:
    1,322
    Location:
    Once in California, previously in the Netherlands
    love these forums; i get to see some really cool software i wouldn't have otherwise. i use mypaint for my random comics, but this looks really cool for other usecases.
     
  4. kuru

    kuru Irate Pyrate

    Joined:
    Jan 13, 2009
    Messages:
    1,390
    Location:
    .de
    I was able to build Drawpile successfully, thanks @ptitSeb for tip #2 and some fiddling with giflib's Makefile.

    My new problem is that Drawpile can't find the themes' icons on start when running from my build folder.
    Code:
    cannot open file '/media/16GB/dev/drawpile-1.0.6/build/theme:draw-brush.svg',
    because: No such file or directory
    Note the ":"

    If I do a make install and run Drawpile from within the C::B shell, that problem is resolved. The .svg files are then located as
    Code:
    /mnt/utmp/codeblocks/usr/share/Drawpile/Drawpile/theme/light/draw-brush.svg
    It also works if I copy all of the svg files to "theme:<filename>.svg" or "darktheme:<filename>.svg" and move them to the root of my build directory. But that doesn't seem like the smart way to do this.

    1) Is there something about the ":" I don't get?
    2) Can I maybe link those files in some way?
    3) I expect that "/media/16GB/codeblocks/usr/share" is in some search path, so the files are found, but again, what's with the ":"?

    Feels like there should be an easy answer to this. Looking forward to your ideas!
     
  5. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,183
    Location:
    France, near Lyon
    the ":" is because it's relative to Qt ressources and not absolute file path. Qt ressources are probably looked in the share folder relative to the --prefix you defined at ./configure time (if it's based on autotools).
     
  6. kuru

    kuru Irate Pyrate

    Joined:
    Jan 13, 2009
    Messages:
    1,390
    Location:
    .de
    I did put "/mnt/utmp/codeblocks/usr" as install prefix in ccmake

    I don't quite understand :( Would setting prefix to "." work, as in use the build directory?

    I'll just kep trying until it somehow works :D
     
    Last edited: Jan 29, 2017
  7. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,183
    Location:
    France, near Lyon
    It depend, what do you want to do? just a setup for yourself or building a pnd?
     
  8. kuru

    kuru Irate Pyrate

    Joined:
    Jan 13, 2009
    Messages:
    1,390
    Location:
    .de
    I am trying to build a pnd

    Edit: Setting prefix to "." didn't help.
    I don't understand how theme: and darktheme: are defined
    I could aswell go ahead and just copy the files over and rename them to the name containing ":"
    That would be ugly but work.

    I need a break ;)
     
  9. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,183
    Location:
    France, near Lyon
    to build a pnd, here is my advised (just my 2cts, there are probably better way to do, but that way works well enough for me).

    1. some where in your dev sdcard (that is Ext formated of course), create the folder that will contain the software, and will be the "root" of the pnd, lets call it drawpile.
    Code:
    cd /PATH/TO/MY/WORKROOT
    mkdir drawpile
    
    2. now create a floder with the same name in /mnt/utmp to simulate a mounted PND (you will need sudo here)
    Code:
    sudo mkdir /mnt/utmp/drawpile
    
    3. now you will temporary "mount" that "fake" pnd with your real working folder on your sdcard
    Code:
    sudo mount -n --bind /PATH/TO/MY/WORKROOT/drawpile /mnt/utmp/drawpile
    
    4. build your software using --prefix=/mnt/utmp/drawpile that way, hard coded folder will be in the "PND" folder
    5. install your software. It will go nicely to /mnt/utmp/drawpile, that is in fact in your sdcard
    6. Now finish the PND, by putting icon, PXML, and dependancies lib (use copy_libs.sh script to help)
    7. Because it's a Qt software, some stuff need to be copied by hand. Take a look at working PND on the repo (from canceco or myself) for example on what to copy and export to add to the runscript (plugins folder will probably be important).
    8. Unmount the "fake pnd" with
    Code:
    sudo umount /mnt/utmp/drawpile
    
    9. you can now package you PND (using the pnd_make.sh script) and ready to test it.

    It's rough and quick, but that will give you a headstart.
     
    kuru likes this.
  10. kuru

    kuru Irate Pyrate

    Joined:
    Jan 13, 2009
    Messages:
    1,390
    Location:
    .de
    I had already created a fake pnd folde rin /mnt/utmp but didnt quite know how to go from there, I would have messed it up by writing stuff to nand I guess ^^

    Making stuff for our PND system seems a level more complicated than building stuff the normal way. More so for a total noob like me. Many thanks for these steps!

    Edit: make install fails as it deletes bin/drawpile and then complains about the very same missing,
    I guess installing to build folder is a no-go

    Edit: make install from build folder to another folder mounted on /mnt/utmp/drawpile works.
    Alas once more the .svg are reported missing, same as before.

    Went for copying the .svg files, renamed them with
    Code:
    for $file in *.svg; do mv "$file" "theme:$file"; done
    
    and the same for "themedark:" now that damned error is gone and all the icons show up in the app. Except a handful which just plainly aren't there in the first place. That's my patience spent for now.


    Edit: Is this a matter of setting ld_library_path!?


    Having a look at the start script of @canseco's Tiled helped a lot. Should have thought of that myself earlier.
    In other news:
    1. learn about ldd
    2. learn about printenv
    3. ...
    4. profit

    Lest I forget: Using perl module 'markdown' to convert .md files to .html replacing suffix at the same time
    Code:
    for file in *.md ; do markdown "$file" > "${file%.md}.html" ; done
    


    Edit: PXML woes
    1) PXML.xml must be present within package as well as appended to PND
    2) PND Manager renames downloaded PND to the 'package id' specified in the xml
    3) The name of the utmp subfolder and the appdata subfolder are determined by the 'application id'
     
    Last edited: Feb 1, 2017

Share This Page

Loading...