VincentWei / MiniGUI

A modern and mature cross-platform window system for embedded systems and smart IoT devices.
http://www.minigui.com
GNU General Public License v3.0
695 stars 157 forks source link

编译HelloWord程序报错 #75

Closed Javier-Huang closed 3 years ago

Javier-Huang commented 3 years ago

minigui库已经交叉编译并安装到交叉编译的sysroot,然后编译helloworld程序时,报了minigui缺少一些支持。请问怎么我可以怎么处理,请作者帮忙看看?

minigui版本:3.0.13(之所以使用这个版本,是因为我当前的平台是rockchip,rockchip在该平台维护的是3.0.13版本)

helloworld.c: In function ‘InitCreateInfo’:
helloworld.c:40:26: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     pCreateInfo->hCursor = GetSystemCursor (0);
                          ^
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `sem_init'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_key_create'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_rwlock_rdlock'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `sem_destroy'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_getspecific'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_rwlock_wrlock'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_create'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_rwlock_destroy'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_rwlock_init'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_rwlock_unlock'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_key_delete'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `sem_post'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_detach'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `sem_getvalue'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_setspecific'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `sem_wait'
/usr/aarch64-linux-gnu/lib//libminigui_ths.so: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
Makefile:19: recipe for target 'ALL' failed
make: *** [ALL] Error 1
Javier-Huang commented 3 years ago

这是我的Makefile

PROJECT_DIR := $(shell pwd)

BIN = helloworld

SRC = helloworld.c

CC = aarch64-linux-gnu-gcc

CFLAGS ?= -I /usr/aarch64-linux-gnu/include/ \
    -L /usr/aarch64-linux-gnu/lib/ \
    -lpthread -lminigui_ths -lpng12 -lm \
    -lfreetype -ldrm -lts -ljpeg

ALL:
    $(CC) -o $(BIN) $(SRC) $(CFLAGS)

clean:
    rm -rf *.o $(BIN)
Javier-Huang commented 3 years ago

问题解决,调整库文件的顺序为: -lminigui_ths -lpthread -lpng12 -lm -lfreetype -ldrm -lts -ljpeg