2018年3月23日金曜日

Building Xorg on widows subsystem (ubuntu on Windows)

This is my note of the experimental trial of building X11 on windows subsystem. It is not yet succeeded as of today 23rd of March 2018. The reason I want to try to building x11 is that windows doesn't provide a nice console to use bush on ubuntu on windows. I want to use basic unix/linux tools like xterm,xeye ... Thereis already xming that enable us to use x wundow system on windows by the easy installer. however the version of xorg is a little bit old. so let's try to build it from source

Install required package

My reference at first is the building tutorial by the official Xorg web site.
https://www.x.org/wiki/Building_the_X_Window_System/
It seems that I have to install required package, which is necessary to build x11. Here are the all what I need
https://www.x.org/wiki/RequiredPackages/
It is ubuntu on my windows subsystem then install all by the command with apt-get.
$sudo apt-get install asciidoc autoconf automake autopoint autotools-dev  bison docbook-utils doxygen flex fop git-core  gperf intltool jadetex libdrm-dev libfontconfig1-dev libfreetype6-dev libgbm-dev libglib2.0-dev libmtdev-dev libncurses5-dev libpng12-dev libssl-dev libtool libudev-dev llvm m4  netpbm psutils python-mako systemtap-sdt-dev w3m xmlto  zlib1g-dev
now install starts and seems it takes very long, ans it took very long. once apt-get finished, get the source code using git clone and following the instruction by the official website. to tell the truce you have to install more. I am writing as it happened. please see the bellow Install-newer-LLVM

Start building Xorg

cd $HOME/src 
$git clone git://anongit.freedesktop.org/git/xorg/util/modular util/modular
$mkdir $HOME/build
$cd $HOME/src
then let's build the xorg
./util/modular/build.sh --clone $HOME/build
or use --autoresume and -n option. I operated it with sudo. because some modules need the permission to create a directory to install the lib. The -n option allows the build script to continue the build with the next module. When the script terminates, it reports which ones failed. The --autoresume option writes a list of modules and can restart where it left off after you fixed the build error. (ref)
 sudo ./util/modular/build.sh -n --autoresume resumefile  --clone /home/kanshu/XorgX11/build
please be noticed that if you cone the source code not the same place as above like $HOME/build, build.sh destination path must be a full path. It took hours until I got the bellow error... configure: error: LLVM 3.9.0 or newer is required for r600 build.sh: "./autogen.sh" failed on mesa/mesa build.sh: error processing: "mesa/mesa" since apt-get installed LLVM version 3.8 by default, I have to install newer version of LLVM.

Install newer llvm

Go to the official web site to see the details. http://apt.llvm.org/ Here is what I did. edit souce.list file, which is found in /etc/apt/
$sudo vi /etc/apt/source.list
since my ubuntu version is xenial, add bellow lines into the source.list
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
# 5.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
# 6.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
if you want to know the Linux version, check cat /etc/lsb-release . do apt-get update to reflect the change on apt get.
sudo apt-get update
To retrieve the archive signature:
$wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
# Fingerprint: 6084 F3CF 814B 57C1 CF12 EFD5 15CF 4D18 AF4F 7421 
$apt-get install llvm 
$apt autoremove
then, newer LLVM was installed. do building Xorg again...
Package libtizcore was not found in the pkg-config search path.
Perhaps you should add the directory containing `libtizcore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libtizcore' found
checking for RADEON... yes
checking for RADEON... yes
configure: error: r600 requires libelf when using llvm
another error ... it is still stuck on libtizcore but i think it skipped.

Install libelf

https://packages.ubuntu.com/xenial/libelf-dev It seems like I have to install libelf-dev by using apt-get.
$ sudo apt-get install libelf-dev
let's continue building Xorg again ... there is still error...
./util/modular/build.sh: 691: ./util/modular/build.sh: meson: not found
build.sh: "meson" failed on app/rendercheck
build.sh: error processing:  "app/rendercheck"

Install meson

http://mesonbuild.com/Getting-meson.html I need to install pip3 at first
$sudo apt-get -y install python3-pip
$pip3 install --upgrade pip
then install meson by using pip3.
$pip3 install meson
let's continue building Xorg again ...
Configuring rendercheck.1 using configuration
Build targets in project: 1

ERROR: Could not detect Ninja v1.5 or newer

A full log can be found at /home/XorgX11/src/app/rendercheck/builddir/meson-logs/meson-log.txt
build.sh: "meson" failed on app/rendercheck
build.sh: error processing:  "app/rendercheck"

Install ninja

https://ninja-build.org/
$apt-get install ninja-build 
sill getting an error...
======================================================================
==  Processing:  "app/rendercheck"
==        configuration options:
./util/modular/build.sh: 731: [: missing ]
ninja: Entering directory `builddir'
ninja: error: loading 'build.ninja': No such file or directory
build.sh: "ninja -C builddir" failed on app/rendercheck
build.sh: error processing:  "app/rendercheck"
Probably there were old files in the directly app/rendercheck. It would be solved by erasing everything in the directory. My guess was correct and I got another error ....
make[2]: Entering directory '/home/kanshu/XorgX11/src/app/xdm'
make[2]: Nothing to be done for 'install-exec-am'.
 /bin/mkdir -p '/lib/systemd/system'
 /usr/bin/install -c -m 644 xdm.service '/lib/systemd/system'
/usr/bin/install: cannot create regular file '/lib/systemd/system/xdm.service': Permission denied
Makefile:538: recipe for target 'install-systemdsystemunitDATA' failed
make[2]: *** [install-systemdsystemunitDATA] Error 1
make[2]: Leaving directory '/home/kanshu/XorgX11/src/app/xdm'
Makefile:869: recipe for target 'install-am' failed
make[1]: *** [install-am] Error 2
make[1]: Leaving directory '/home/kanshu/XorgX11/src/app/xdm'
Makefile:566: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
build.sh: " env LD_LIBRARY_PATH=/home/kanshu/XorgX11/build/lib make  install" failed on app/xdm
build.sh: error processing:  "app/xdm"
I forgot to install with root permission... doing with 'sudo' option.
checking for GLAMOR... no
configure: error: Package requirements (epoxy) were not met:

No package 'epoxy' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GLAMOR_CFLAGS
and GLAMOR_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
build.sh: "./autogen.sh" failed on xserver
build.sh: error processing:  "xserver"

libepoxy

what is 'epoxy' ? Epoxy is a library for handling OpenGL function pointer management for you. It hides the complexity of dlopen(), dlsym(), glXGetProcAddress(), eglGetProcAddress(), etc. from the app developer, with very little knowledge needed on their part. They get to read GL specs and write code using undecorated function names like glCompileShader(). from git repository of libepoxy it sounds interesting. let's install it as well.
$ sudo apt-get install libepoxy-dev
that works good. next error is
==  Processing:  "libinput"
==        configuration options:
./util/modular/build.sh: 691: ./util/modular/build.sh: meson: not found
build.sh: "meson" failed on libinput
build.sh: error processing:  "libinput"
I think it is because meson was installed in my "$HOME/.local/bin/meson". since I call the build.sh usin sudo, the path to meson was not found. I have to install meson as root user. I still got error
meson.build:59:1: ERROR: Native dependency 'libwacom' not found

A full log can be found at /home/kanshu/XorgX11/src/libinput/builddir/meson-logs/meson-log.txt
build.sh: "meson" failed on libinput
build.sh: error processing:  "libinput"
there are also error on processing: "driver/xf86-video-v4l" and other drivers.
v4l.c: In function ‘V4LInit’:
v4l.c:1206:25: error: ‘VIDEO_INVERT_CLIPLIST’ undeclared (first use in this function)
         VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
                         ^
Makefile:474: recipe for target 'v4l.lo' failed
make[2]: *** [v4l.lo] Error 1
make[2]: Leaving directory '/home/kanshu/XorgX11/src/driver/xf86-video-v4l/src'
Makefile:439: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/kanshu/XorgX11/src/driver/xf86-video-v4l'
Makefile:371: recipe for target 'all' failed
make: *** [all] Error 2
build.sh: "make " failed on driver/xf86-video-v4l
build.sh: error processing:  "driver/xf86-video-v4l"
I gave up at here. I also realized that i had great misunderstanding. I need to build Xorg on visual studio to use it with windows 10 and the Ubuntu subsystem. so let's try common solution to use VcXsrv or Xming.

0 件のコメント:

コメントを投稿