cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
108 Views
Registered: ‎06-01-2020

How to specify the library path to link?

Hi, everyone

I am implementing the user app under petalinux environment on the ZCU102.

I encountered the problem that ld error as following in library linking.

aarch64-xilinx-linux-gcc --sysroot=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0=/usr/src/debug/hctphy/1.0-r0 -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot= -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/libxml2/libxml -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -L/usr/lib -o hctphy hctphy_main.o hctphy_dbus_iface.o hctphy_proc_msg.o hctmm_log.o -lpthread -lxml2 -lrt -lgio-2.0 -lgobject-2.0 -lglib-2.0
/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/7.3.0/ld: warning: library search path "/usr/lib" is unsafe for cross-compilation
/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/7.3.0/ld: cannot find -lxml2
/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/7.3.0/ld: cannot find -lgio-2.0
/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/7.3.0/ld: cannot find -lgobject-2.0
/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-xilinx-linux/../../libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/7.3.0/ld: cannot find -lglib-2.0
collect2: error: ld returned 1 exit status
make: *** [Makefile:25: hctphy] Error 1
ERROR: oe_runmake failed

 

Makefile is as following

APP = hctphy

CFLAGS += -I/usr/include/glib-2.0 \
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include \
-I/usr/include/gio-unix-2.0/ \
-I/usr/include/libxml2/libxml

LDFLAGS += -L/usr/lib
LDLIBS += -lpthread
LDLIBS += -lxml2
LDLIBS += -lrt
LDLIBS += -lgio-2.0 -lgobject-2.0 -lglib-2.0

# Add any other object files to this list below
APP_OBJS = hctphy_main.o \
hctphy_dbus_iface.o \
hctphy_proc_msg.o \
hctmm_log.o

all: build

build: $(APP)

$(APP): $(APP_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)

 

I assume that the error is caused by wrong specifying the library path.

I would like to ask for a guide on how to specify the library path if my guess is correct.

 

Another Issue is warring as following.

aarch64-xilinx-linux-gcc --sysroot=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0=/usr/src/debug/hctphy/1.0-r0 -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot= -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/libxml2/libxml -c -o hctphy_main.o hctphy_main.c
aarch64-xilinx-linux-gcc --sysroot=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0=/usr/src/debug/hctphy/1.0-r0 -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot= -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/libxml2/libxml -c -o hctphy_dbus_iface.o hctphy_dbus_iface.c
aarch64-xilinx-linux-gcc --sysroot=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0=/usr/src/debug/hctphy/1.0-r0 -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot= -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/libxml2/libxml -c -o hctphy_proc_msg.o hctphy_proc_msg.c
aarch64-xilinx-linux-gcc --sysroot=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0=/usr/src/debug/hctphy/1.0-r0 -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/home/yeomjs/Project/ptlinux_prj_01/xilinx-zcu102-2018.3/build/tmp/work/aarch64-xilinx-linux/hctphy/1.0-r0/recipe-sysroot= -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/libxml2/libxml -c -o hctmm_log.o hctmm_log.c
cc1: warning: include location "/usr/include/glib-2.0" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/gio-unix-2.0/" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libxml2/libxml" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/glib-2.0" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/gio-unix-2.0/" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libxml2/libxml" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/glib-2.0" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/gio-unix-2.0/" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libxml2/libxml" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/glib-2.0" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/gio-unix-2.0/" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include/libxml2/libxml" is unsafe for cross-compilation [-Wpoison-system-directories]

 

This warring also seems to be the problem of specifying the include path. Please guide how to specify it.

 

Thanks,

Yeom Jaesung

 

 

0 Kudos
0 Replies