VincentWei / build-minigui-4.0

The building scripts for MiniGUI 4.0
GNU General Public License v3.0
13 stars 9 forks source link

How to build minigui-4.0 in ubuntu 19.04 x86-64 #2

Open chyyuu opened 5 years ago

chyyuu commented 5 years ago

Based on README.md. Just describe the differences and some problems&solutions.

step 1 : a little difference

sudo apt install git gcc g++ binutils autoconf automake libtool make cmake pkg-config libgtk2.0-dev libjpeg-dev libpng-dev libfreetype6-dev libinput-dev libdrm-dev libsqlite3-dev libxml2-dev  libssl-dev electric-fence

step 2~3 : same & no problem

step 4: meet some compiling problems, but can fix them.

minigui package

compiling errors (warning as error)

In file included from /usr/include/string.h:494,
                 from misc.c:56:
In function 'strcpy',
    inlined from 'strtrimall' at misc.c:1435:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:90:10: error: '__builtin_strcpy' accessing between 0 and 9223372036854775806 bytes at offsets 0 and [0, 2147483647] may overlap up to 9223372036854775806 bytes at offset 9223372036854775804 [-Werror=restrict]
   90 |   return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

solutions

The gcc compiling parameter "-Werror" is too strict. We can reduce compiler's requirement by change minigui/configure.ac by remove "-Werror"

$ diff configure.ac configure.ac.org
2555c2555
<         CFLAGS="$CFLAGS -Wall"
---
>         CFLAGS="$CFLAGS -Wall -Werror"

The other packages, such as cell-phone-ux-demo, mgncs, mgplus, mg-demos, mgutils, mg-samples, need the same changes for configure.ac in each package.

compiling errors (missing files)

ubuntu 19.04 didn't have freetype-config, so gcc/g++ can not find some freetype2 include files when compiling mgplus.

g++ -DHAVE_CONFIG_H -I. -I../.. -D__MGPLUS_LIB__ -D_DEBUG -Wall -Werror -g -O2 -MT agg_bezier_arc.lo -MD -MP -MF .deps/agg_bezier_arc.Tpo -c agg_bezier_arc.cpp -o agg_bezier_arc.o >/dev/null 2>&1
In file included from font_freetype/agg_font_freetype.cpp:47:
font_freetype/agg_font_freetype.h:49:10: fatal error: ft2build.h: No such file or directory
   49 | #include <ft2build.h>
      |          ^~~~~~~~~~~~
compilation terminated.

solutions

ubuntu 19.04 didn't have freetype-config, but we can use pkg-config to get the same requirements.

diff configure.ac configure.ac.org
255,256c255,256
<     FT2_CFLAGS="`pkg-config freetype2 --cflags`"
<     FT2_LIBS="`pkg-config freetype2  --libs`"
---
>     FT2_CFLAGS="`freetype-config --cflags`"
>     FT2_LIBS="`freetype-config --libs`"
266c266
<         CPPFLAGS="$CPPFLAGS -Wall"
---
>         CPPFLAGS="$CPPFLAGS -Wall -Werror"

step5: : same & no problem

97638598

VincentWei commented 5 years ago

Great! We will consider to make -Werror managed by a configuration option.

VincentWei commented 5 years ago

I have moved the --enable-develmode to a global Shell variable in my_config.sh file:

# GOPTS=--enable-develmode
GOPTS=

By default, the scripts will not enable the developer mode. So there will be no -Werror option enabled for GCC.

I also tune the configure.ac file of mGPlus to use pkg-config instead of freetype-config.