How to build qtwayland? - linux

I spent whole day trying to use QtWayland.Compositor 1.0 in Qt creator. I have followed all the steps from there https://wiki.qt.io/QtWayland but I get the following error. I don't know what does it mean, that is my first contact with linux. I have the newest linux mint on a vm.
$ sudo make install
cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/emil/wayland/qtwayland/src/src.pro -o Makefile ) && make -f Makefile install
make[1]: Entering directory '/home/emil/wayland/qtwayland/src'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/emil/wayland/qtwayland/src'
cd examples/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/emil/wayland/qtwayland/examples/examples.pro -o Makefile ) && make -f Makefile install
make[1]: Entering directory '/home/emil/wayland/qtwayland/examples'
cd wayland/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/emil/wayland/qtwayland/examples/wayland/wayland.pro -o Makefile ) && make -f Makefile install
make[2]: Entering directory '/home/emil/wayland/qtwayland/examples/wayland'
Some of the required modules (qtHaveModule(waylandcompositor) qtConfig(opengl)) are not available.
Skipped.
make[2]: Leaving directory '/home/emil/wayland/qtwayland/examples/wayland'
make[1]: Leaving directory '/home/emil/wayland/qtwayland/examples'
how can I fix that? All I want to do is to run the examples from the Qt installation :c.

Most of the content on the wiki page was written many years ago. I made an effort to clean up things I know are not relevant anymore and hope to get the wiki page in a usable state.
The problem as I see it, is that there are so many ways to build Qt, and how to build QtWayland depends on that.
The two most common options:
Building QtWayland as part of a full (or toplevel Qt build)
When configuring Qt, you can add -feature-wayland-server to you configure line. And it will make sure the wayland compositor API is part of your Qt build. Configure will then fail if the dependencies of QtWayland is not met. I.e. if you need dev packages for Wayland.
Then you can either just run make which will build all of Qt as you configured it, or run make module-qtwayland which should only build QtWayland and the required dependencies (qtbase, qtdeclarative, qtxmlpatterns).
Building QtWayland against an existing Qt installation (without QtWayland)
First you need to find qmake for your desired Qt version. If it's the one provided by the system, it's usually on your PATH already. If you are going to use Qt provided by the Qt installer, it's usually in ~/Qt/5.10.0/gcc_64/bin/qmake or equivalent for your version and architecture.
Clone qtwayland
git clone git://code.qt.io/qt/qtwayland.git
cd qtwayland
git checkout v5.10.0 #or whatever version your qmake reports
Configure with qmake
qmake
or
~/Qt/5.10.0/gcc_64/bin/qmake
You should now see:
Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes
In your terminal, or else you are probably missing some dependencies.
Build with make
make
make install
Build examples
Depending on your configuration, this may need to be run explicitly:
make sub-examples

Related

Build custom driver for linux

I am new to building C lib and have mostly worked with python. My goal is to take the source code from https://github.com/torvalds/linux and build a custom driver for USB/IP (https://github.com/torvalds/linux/tree/master/drivers/usb/usbip) module (some modification).
I copied only /tool/usbip/ assuming that USB and USB-IP are already present in the alpine.
I have set up a docker Image:
FROM alpine
COPY . .
RUN apk add build-base autoconf automake libtool eudev-dev libusb-dev
WORKDIR /tool/usbip/
RUN ./autogen.sh
RUN ./configure
RUN make install
I am getting the following error for make install:
Step 7/7 : RUN make install
---> Running in 48f53c225a99
Making install in libsrc
make[1]: Entering directory '/tool/usbip/libsrc'
CC libusbip_la-names.lo
In file included from names.c:23:
usbip_common.h:18:10: fatal error: linux/usb/ch9.h: No such file or directory
18 | #include <linux/usb/ch9.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:459: libusbip_la-names.lo] Error 1
make[1]: Leaving directory '/tool/usbip/libsrc'
make: *** [Makefile:500: install-recursive] Error 1
This could mean that alpine doesn't have a USB drive. How do I compile and install the driver in that docker?
Another solution can be to build the entire Linux code from the repo, but can I use alpine and add a USB-IP driver there, as I can see that alpine is very lightweight?
I see some Kconfig and Makefile, but I need guidance on building the required driver, as my task also requires modifying drivers/USB/usbip code and building the driver for usbip.
Some blog links or youtube videos on build drivers will also help, but I was not able to find any good resources online.
Updated docker file:
FROM alpine:latest
COPY . /linux
RUN apk add build-base autoconf \
automake libtool eudev-dev \
linux-headers flex bison gmp-dev \
mpc1-dev mpfr-dev
WORKDIR /linux
RUN zcat /proc/config.gz > .config
RUN make olddefconfig
RUN make modules_prepare
RUN make M=drivers/usb/usbip modules
WORKDIR /linux/tools/usb/usbip/
RUN ./autogen.sh
RUN ./configure
RUN make install
Download kernel sources and go to its root.
Copy .config for system you want to build for. E.g. if it is your running system and it provides /proc/config.gz then zcat /proc/config.gz > .config
make olddefconfig
Ensure CONFIG_USBIP and other modules are enabled as a modules:
$ grep CONFIG_USBIP .config
CONFIG_USBIP_CORE=m
CONFIG_USBIP_VHCI_HCD=m
CONFIG_USBIP_VHCI_HC_PORTS=8
CONFIG_USBIP_VHCI_NR_HCS=1
CONFIG_USBIP_HOST=m
# CONFIG_USBIP_DEBUG is not set
If not, run make nconfig (or make menuconfig), navigate to Device Drivers->USB support->USB/IP support and enable it as a module (<M>); save configuration.
make modules_prepare
make M=drivers/usb/usbip modules
Your modules are in drivers/usb/usbip/

"sudo make x11-dist-install", no rule to generate

So, I'm trying to getting setup on Ubuntu the g-samples of g-truc.
Installed build-essentials and a lot of dev mesa libs.
cmake works flawless.
However, the linux instructions are the following:
Install the GLFW library included in the external directory. -- sudo make x11-dist-install
Run CMake to create a makefile for GCC
Launch the sample from the build output directory
But if I run sudo make x11-dist-install from within gl-samples/external/glfw-3.1.1
make: *** no rule to generate "x11-dist-install" objective. Stop.
According to g-truc, it looks like a glfw bug, but I don't know if it's really the case or I'm just doing something wrong
I updated to glfw 3.2.1 and it worked
Downloaded 3.2.1.zip here, extracted along with 3.1.1, modified accordingly CMakeLists.txt as follow:
################################
# Add GLFW
set(GLFW_DIRECTORY glfw-3.2.1)
and reloaded

How do I Distribute my Haxe application with Hashlink?

I've got a Haxe Application that I want to make available to people with a Windows system. I use Hashlink to run the Application locally and it works very nicely.
I am wondering if I'm supposed to distribute my Application with Hashlink. Can it build me an .exe?
It looks like generating distributable binary files isn't supported out of the box today (March 10, 2017):
> haxe -main Main -hl main.c
Code generated in main.c automatic native compilation not yet implemented
Hopefully it will be supported soon!
Note: I'm talking about building a final executable using hashlink. An entirely separate approach I do not cover here is the possibility of delivering the hashlink virtual machine with your output hl bitcode.
Sane people stop reading here.
But in the meantime... it is possible to generate binaries with hashlink today if you build hashlink from source.
Warnings:
This isn't a generic, cross-platform answer to your question -- it's just my experience on Linux.
There will probably soon be a better way than this.
But I wanted to jot these notes down even for myself to recall later.
Here's what I had to do on Ubuntu 14.04, 64-bit:
Install prerequisite libraries for building hl (there may be others I already have installed, like build-essential, etc)
sudo apt-get install libvorbis-dev libturbojpeg libsdl2-dev libopenal-dev libssl-dev
Clone and build the mbedtls library: (rev note: b5ba28)
cd ~/dev/
git clone https://github.com/ARMmbed/mbedtls.git
cd mbedtls
make CFLAGS='-fPIC'
Clone the hashlink repo: (rev note: eaa92b)
cd ~/dev/
git clone https://github.com/HaxeFoundation/hashlink.git
cd hashlink
In the # Linux section of the Makefile, ~line 67, add these flags:
CFLAGS += -I ../mbedtls/include
LIBFLAGS += -L../mbedtls/library
Now build with make
If everything works, you'll see two important output files, hl and libhl.so
Ok, at this point, it's easiest if you just build your project in the hashlink directory. For example:
# Still in the hashlink directory
haxe -cp /path/to/my/project -debug -main Main.hx -hl src/_main.c
Now run make hlc, and if everything works, hlc is the output executable (which depends on libhl.so):
cp libhl.so hlc /tmp/
cd /tmp/
./hlc
Prints:
Main.hx:7: Hello world!

How do I build the ManDVD package from compressed source on Linux?

When I try to install any compressed file into Linux I never can, because:
When I execute ./configure the system says bash: ./configure: No such file or directory.
When I execute sudo ./configure the system says sudo: ./configure: command not found.
Worst , when I execute make the system says make: *** No rule to make target '/usr/lib64/qt-3.3/mkspecs/default/qmake.conf', needed by 'Makefile'. Stop.
With make install the system says make: *** No rule to make target '/usr/lib64/qt-3.3/mkspecs/default/qmake.conf', needed by 'Makefile'. Stop.
Completion: I can't install nothing that is not in the repository into my system.
Note: I use Linux Mint XFCE 13 (Maya).
What can I do to solve this unpleasant problem?
As ManDVD's Makefile says:
#############################################################################
# Makefile for building: mandvd
# Generated by qmake (1.07a) (Qt 3.3.8b) on: Sun Mar 8 18:32:50 2009
# Project: mandvd.pro
# Template: app
# Command: $(QMAKE) -o Makefile mandvd.pro
#############################################################################
Makefile was autogenerated by qmake.
I'm no expert at using qmake, but I think executing qmake will re-generate Makefile, so then you can run make && sudo make install as INSTALL file says.
You should've already discovered project is kind of messy (if not discontinued at all), so take care, and may the force be with you :)

How do I create an 'install' package for a Qt application?

Generally to install a package on a linux-based operating system you use
./configure
make
make install
How does this work? And how do I create a package that can be installed this way?
My application uses the Qt framework and I think I'm aiming for something like "MyPackage.tar.gz"
You can create a debian package from your projects. As I understood you want to create a package intended for distibution so I would suggest creating a debian package from your project. Here is an introduction for Debian Packaging system. In the article they at some point describe how to create a "rules" file which is at the core of the build process. Here is a sample of it that I typically use for my Qt/KDE projects:
#!/usr/bin/make -f
#export DH_VERBOSE=1
# This is the debhelper compatability version to use.
#export DH_COMPAT=3
DESTDIR=$(CURDIR)/debian/project
TR_DIR=$(CURDIR)/debian/project/usr/share/qt4/translations
configure:
qmake project.pro
clean:
dh_testdir
dh_testroot
dh_clean
build: configure
dh_testdir
lrelease translations/project_en.ts
$(MAKE)
install: build
mkdir -p $(TR_DIR)
cp translations/project_en.qm $(TR_DIR)
$(MAKE) INSTALL_ROOT=$(CURDIR)/debian/project install
dh_installdirs
binary-arch: build install
dh_testdir
dh_testroot
dh_installmenu
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
This is normally sufficent for small projects.
configure is usually part of GNU build system (autotools), which is not in use in a typical Qt project. qmake is used instead for build file generation and it internally handles most of the tasks configure does for non-qt projects.
The typical build install process for a Qt application is
qmake
make
make install
You could create a simple ./configure script that calls qmake if you need the command names to be identical. You can also use autotools with Qt if you need it, see e.g. Qt Creator Instructions For Autotools
Qt is often used with CMake, which I highly recommend. One notable point is that it likes out-of-source-builds.
Your configure script could be
#!/bin/bash
(mkdir build; cd build; ccmake ..)
and the makefile could be
#!/bin/bash
(cd build; make)
Newer versions of debhelper support qmake. A rules file like,
#!/usr/bin/make -f
%:
dh $# --buildsystem=qmake
Is all that is needed. You need,
bar.file = foo
bar.path = install/dir
INSTALLS += bar
Inside your projects 'pro' or qmake file. qmake will create install targets and the perl file /usr/share/perl5/Debian/Debhelper/Buildsystem/qmake.pm will get called and parse the qmake file. You need to create 'debian/' files, changelog, compat, control, copyright as well the rules file.

Resources