Page 1 of 1

[solved] Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Thu Dec 29, 2016 4:27 am
by dungle25895
Hi everybody,

I've found the document how to run qcad on server here: viewtopic.php?t=3568

Then I try run qcad 3.16.3 on ubuntu server 16.04 with command:

Code: Select all

./dwg2pdf -f /tmp/sample.dxf
it throw error
3.16.3.png
3.16.3.png (8.78 KiB) Viewed 10379 times
Then I try with qcad 3.15.5, it work as well
3.15.5.png
3.15.5.png (9.26 KiB) Viewed 10379 times
I think problem from qt5. Anybody help me please

Re: Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Thu Dec 29, 2016 5:24 pm
by andrew
Thanks for your report. I can confirm that this has indeed changed with Qt 5.

Please save the appropriate attached "offscreen" plugin to the "platforms" directory of your QCAD installation and unpack it (gunzip libqoffscreen.so.gz). You might also have to make it executable (chmod a+x libqoffscreen.so).

You can then run dwg2pdf (and other command line utilities) with the command line switch -platform offscreen:

Code: Select all

./dwg2pdf -platform offscreen -o out.pdf in.dxf
If you are having problems with getting texts rendered, you might have to set the QT_QPA_FONTDIR environment variable to a path which contains the fonts you want to use.

Re: Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Wed Jan 04, 2017 2:08 pm
by andrew
QCAD 3.16.4 is now available. The new Linux packages include the offscreen plugin as well as Qt fonts. Usage information also has been updated accordingly.

Re: Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Wed Jan 25, 2017 2:15 pm
by hungerburg
On my Xubuntu 16.04 I get this - run with 1) display, 2) without display, 3) without display offscreen; only 1) creates a PDF:

Code: Select all

$ /opt/qcad/dwg2pdf MY.dxf 
QCAD version  3.16.4
...
Converting
  from: /tmp/MY.dxf
  to  : /tmp/MY.pdf

Code: Select all

$ DISPLAY="" /opt/qcad/dwg2pdf MY.dxf 
QCAD version  3.16.4
Fatal:    QXcbConnection: Could not connect to display 
/opt/qcad/qcad: Zeile 8: 16180 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$DIR" "$binary" "$@"

Code: Select all

$ DISPLAY="" /opt/qcad/dwg2pdf -platform offscreen MY.dxf 
QCAD version  3.16.4

(qcad-bin:16195): Gtk-WARNING **: cannot open display: 
The last should not fail; Curious as to why Gtk - Maybe some theme - but offscreen. Can you advise?

Re: Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Thu Jan 26, 2017 8:30 am
by andrew
hungerbug: can you try without the DISPLAY="" bit but with -platform offscreen?

Re: Qcad 3.16.4 can't run on headless Ubuntu 16.04

Posted: Thu Jan 26, 2017 11:32 am
by hungerburg
Hello Andrew, setting DISPLAY="" is the quickest way to test how it works on a headless system. I intend to do this so I took the time to make it run and some magic tools lead the way - This is the expanded command 3) from above with ltrace added:

Code: Select all

DISPLAY="" LD_LIBRARY_PATH="/opt/qcad" ltrace -CS -f -n2 /opt/qcad/qcad-bin -no-dock-icon -no-gui -allow-multiple-instances -platform offscreen -autostart "scripts/Pro/Tools/Dwg2Pdf/Dwg2Pdf.js" /opt/qcad/dwg2pdf -f /tmp/MY.dxf 2>/tmp/out.txt
It not only loads gtk, it even loads libvorbis e.a! A look at what it wants from those libs, its native Themeing. Voilà the working command:

Code: Select all

QT_STYLE_OVERRIDE="" QT_QPA_PLATFORM=offscreen QT_QPA_FONTDIR=/usr/share/fonts/ DISPLAY="" LD_LIBRARY_PATH="/opt/qcad" ltrace -CS -f -n2 /opt/qcad/qcad-bin -no-dock-icon -no-gui -allow-multiple-instances -autostart "scripts/Pro/Tools/Dwg2Pdf/Dwg2Pdf.js" /opt/qcad/dwg2pdf -f /tmp/MY.dxf 2>/tmp/out.txt
Remember that recently you dropped "-style plastique" from the starter batch? I did suggest that e_confused A consolidated patch for dwg2pdf soon to appear in flyspray…

Peter

Re: Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Thu Jan 26, 2017 11:38 am
by andrew
Thanks for looking into this. I can reproduce this here when using the arguments -style gtk explicitly.

I suppose this would also work then:

Code: Select all

./dwg2pdf -style "" -platform offscreen ...

Re: Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Thu Jan 26, 2017 2:03 pm
by hungerburg
Hello Andrew, the style="" flag here does not help from reaching out to GTK, when DISPLAY is not set; while setting QT_STYLE_OVERRIDE="" does. (Also -style="asdf" works!)

Your are right, that the tools should not set platform, all the fonts are gone then!

PS: From strace I learned, that qcad-bin looks into /home/andrew/opt/Qt/… Are these search paths hardcoded? I guess they should not be there.

Re: Qcad 3.16.3 can't run on Ubuntu server 16.04

Posted: Thu Jan 26, 2017 2:42 pm
by andrew
hungerburg wrote:while setting QT_STYLE_OVERRIDE="" does. (Also -style="asdf" works!)
OK, thanks.
PS: From strace I learned, that qcad-bin looks into /home/andrew/opt/Qt/… Are these search paths hardcoded?
That's correct. Qt libraries / binaries all contain these hard-coded paths as far as I know.