Without a custom BSP (use an existing TEZI Linux image) and without “opkg install mono” (because it didn’t work: Couldn’t find anything to satisfy ‘mono’), is there a way to create a simple GUI? Perhaps cross compile an “helloworld” gtk program?
Hi
You could try gtk-scribble..
Use a SDK with gtk+ installed, e.g. from here.
Then download the sources. The two Makefiles in the sources have been written to either use
- an OE-Build or
- the (ugly) combination of build host header files and release target libraries.
So to use the SDK you need to copy the attached Makefile into the directory were you extracted the gtk-scribble sources.
Then source the SDK environment and run ‘make’.
Max
The link to an SDK takes me to a Colibri-iMX6 package, but I have an iMX7S V1.1B board. When I go to the iMX7 directory, the install script is “angstrom-glibc-x86_64-armv7at2hf-neon-v2016.12-toolchain.sh”, but I have already loaded, as per a Toradex “how-to” for my setup, “angstrom-glibc-x86_64-armv7at2hf-neon-v2017.12-toolchain.sh”, which looks newer. I don’t see gtk+ in my current setup, do I need to execute the older shell?
Here’s my Makefile so far (which does produce a dot-o file but will not link since I don’t know where to fine the gtk library):
file Makefile
copyright Copyright (c) 2012 Toradex AG
[Software License Agreement]
author $Author$
version $Rev$
date $Date$
brief a simple makefile to (cross) compile.
uses the openembedded provided sysroot and toolchain
target linux on Colibri T20 / Colibri T30
caveats -
##############################################################################
Setup your project settings
##############################################################################
Set the input source files, the binary name and used libraries to link
SRCS = scribble-simple.c
PROG := scribble
LIBS = -L/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/
GTK_LIBS =
C_INCLUDE = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/
GTK_INCLUDE = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/gtk-2.0/
GTK = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/gtk-2.0/include/
PIX = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/gdk-pixbuf-2.0/
ATK = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/atk-1.0/
GIO_INCLUDE = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/glib-2.0/
CAIRO_INCLUDE = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/cairo/
PANGO_INCLUDE = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/pango-1.0/
GLIB_INCLUDE = -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/src/debug/glib-2.0/1_2.52.3-r0/build/glib
Set flags to the compiler and linker
CFLAGS += -O0 -g -Wall $(PKG-CONFIG) --cflags gtk+-2.0
$(ARCH_CFLAGS)
CFLAGS += $(GTK_INCLUDE) $(C_INCLUDE) $(GIO_INCLUDE) $(GLIB_INCLUDE) $(CAIRO_INCLUDE) $(PANGO_INCLUDE) $(GTK) $(PIX) $(ATK)
LDFLAGS += $(PKG-CONFIG) --libs gtk+-2.0
##############################################################################
Setup your build environment
##############################################################################
Set the path to the oe built sysroot and
Set the prefix for the cross compiler
OECORE_NATIVE_SYSROOT ?= /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux
OECORE_TARGET_SYSROOT ?= /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi
CROSS_COMPILE ?= $(OECORE_NATIVE_SYSROOT)usr/bin/armv7ahf-vfp-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-
##############################################################################
The rest of the Makefile usually needs no change
##############################################################################
Set differencies between native and cross compilation
ifneq ($(strip $(CROSS_COMPILE)),)
LDFLAGS += -L$(OECORE_TARGET_SYSROOT)usr/lib -Wl,-rpath-link,$(OECORE_TARGET_SYSROOT)usr/lib -L$(OECORE_TARGET_SYSROOT)lib -Wl,-rpath-link,$(OECORE_TARGET_SYSROOT)lib
ARCH_CFLAGS = -march=armv7-a -fno-tree-vectorize -mthumb-interwork -mfloat-abi=hard -mtune=cortex-a9
BIN_POSTFIX =
PKG-CONFIG = export PKG_CONFIG_SYSROOT_DIR=$(OECORE_TARGET_SYSROOT);
export PKG_CONFIG_PATH=$(OECORE_TARGET_SYSROOT)/usr/lib/pkgconfig/;
$(OECORE_NATIVE_SYSROOT)usr/bin/pkg-config
else
Native compile
PKG-CONFIG = pkg-config
ARCH_CFLAGS =
Append .x86 to the object files and binaries, so that native and cross builds can live side by side
BIN_POSTFIX = .x86
endif
Toolchain binaries
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
STRIP = $(CROSS_COMPILE)strip
RM = rm -f
Sets the output filename and object files
PROG := $(PROG)$(BIN_POSTFIX)
OBJS = $(SRCS:.c=$(BIN_POSTFIX).o)
DEPS = $(OBJS:.o=.o.d)
pull in dependency info for existing .o files
-include $(DEPS)
all: $(PROG)
$(PROG): $(OBJS) Makefile
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(GTK_LIBS) $(LDFLAGS)
#$(STRIP) $@
%$(BIN_POSTFIX).o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
$(CC) -MM $(CFLAGS) $< > $@.d
clean:
$(RM) $(OBJS) $(PROG) $(DEPS)
.PHONY: all clean
$CC -Wall -g scribble-simple.c -o scribble-simple pkg-config --cflags gtk+-2.0
pkg-config --libs gtk+-2.0
Worked! An scp of the result to the iMX7S produced the expected window, no Makefile needed, using my existing SDK.
Perfect, that it worked. Thanks for the feedback.