How to find include path for opkg install libary

hi, i'm new user for openWrt.
i write a simple tcp server with wolfSSL libary , it can build in Ubuntu.
But when i build in MT7620a evk board , can't find include file .

My question : about opkg install library (like wolfssl) , where is include file path ?

This is my Makefile:

	LIB_PATH = /usr/local
	#CFLAGS   = -Wall -I$(LIB_PATH)/include
	CFLAGS   = -I$(LIB_PATH)/include
	LIBS     = -L$(LIB_PATH)/lib -lm

# option variables
	DYN_LIB         = -lwolfssl
	STATIC_LIB      = $(LIB_PATH)/lib/libwolfssl.a
	DEBUG_FLAGS     = -g -DDEBUG
	DEBUG_INC_PATHS = -MD
	OPTIMIZE        = -Os

# Options
	#CFLAGS+=$(DEBUG_FLAGS)
	CFLAGS+=$(OPTIMIZE)
	#CFLAGS+=$(QAT_FLAGS)
	#LIBS+=$(QAT_LIBS)
	#LIBS+=$(STATIC_LIB)
	LIBS+=$(DYN_LIB)

ifeq ("$(platform)","x64")
	CC			=gcc
	LIB			=x64
	TCP_LDFLAGS	=

	DAEMON_SRC		= tcpserver.c
	DAEMON_INC		=-I./ -I./include $(LIBS) -lpthread
endif

ifeq ("$(platform)","cross")
   	CC				=mipsel-openwrt-linux-gcc
    LIB				=
	TCP_LDFLAGS		=-ldl
	DAEMON_SRC		=tcpserver.c
	DAEMON_INC		=-I./ -I./include $(LIBS) -lpthread
endif

ifeq ("$(platform)","")
   	CC				=mipsel-openwrt-linux-musl-gcc
   	LIB				=
	TCP_LDFLAGS		= -g
	DAEMON_SRC		=tcpserver.c
	DAEMON_INC		=-I./ -I./include $(LIBS)
endif

all:
	$(CC) $(DAEMON_SRC)	$(DAEMON_INC) $(TCP_LDFLAGS) $(CFLAGS) -o light_daemon

clean:
	rm light_daemon

when build in evk board , this is error message :slight_smile:

root@OpenWrt:/tmp/nfs/light_1119# make
mipsel-openwrt-linux-musl-gcc tcpserver.c       -I./ -I./include -L/usr/local/lib -lm -lwolfssl -g -I/usr/local/include -Os -o light_daemon
In file included from tcpserver.c:3:0:
tcpserver.h:19:29: fatal error: wolfssl/options.h: No such file or directory
compilation terminated.
make: *** [Makefile:47: all] Error 1

What do you mean by "But when i build in MT7620a evk board , can't find include file ."?
Do you natively build on the evk board with a simple makefile or do you actually use a openwrt compatible package file and its Dev-SDK?

If you want to build for openwrt you need to use the dev-sdk and write a compatible package makefile, your actual source makefile only needs to use the common build variables, which will be set automatically by the SDK to the specific paths for your target/arch.

Basically all includes/libs are build by the SDK and nothing is used from your distro/host for cross-compiling.

2 Likes

Btw you can look at those examples from my feed, i did those in 5mins by some user requests. If you use a normal source makefile only a minimal package makefile is needed + a working openwrt sdk.

simple examples:


example that bypasses source makefile in favor of direct compile via package makefile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.