cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sudhakarb
Visitor
Visitor
424 Views
Registered: ‎11-21-2019

xrfdc.h: fatal error: metal/sys.h: No such file or directory

Hi,

I am trying to design an application library in C++ that uses rfdc functions. Tried to build the code including the xrfdc.h file and want to link the librfdc.so and libmetal .so files so that I can access the library functionality.

When I am building my code, it is failed on #include <metal/sys.h>. Then I tried with a C file instead of C++ but ended up in the same error. Final goal is to go with C++ application that uses librfdc and libmetal functionality.

I am using Petalinux 2019.2 on Ubuntu 18.04. The XSA file is generated for ZCU111 (XCZU28R) using Vivado 2019.2.

Attached is my makefile that currently tailored for C. Tried various options to direct to libmetal and librfdc but in vain. 

I am really lost in this activity and going clueless on how to utilize the functions from rfdc library in my application with this libmetal linking failure.Do I need to include all .h files of rfdc and libmetal in my application code??
 
Have gone through several Xilinx confluence pages, discussion forums and PG/UG guides but could not resolve the issue. Please help me.

 

Following is the latest log:

-----------------------

Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 4
| gcc -Wall -c -o rfdc_interface.o rfdc_interface.c
| gcc -Wall -c -o clock_interface.o clock_interface.c
| gcc -Wall -c -o rfdc_functions.o rfdc_functions.c
| gcc -Wall -c -o data_interface.o data_interface.c
| In file included from rfdc_interface.h:42:0,
| from rfdc_interface.c:33:
| xrfdc.h:284:10: fatal error: metal/sys.h: No such file or directory
| #include <metal/sys.h>
| ^~~~~~~~~~~~~
| compilation terminated.
| make: *** [<builtin>: rfdc_interface.o] Error 1
| make: *** Waiting for unfinished jobs....
| In file included from rfdc_functions.h:37:0,
| from rfdc_functions.c:34:
| xrfdc.h:284:10: fatal error: metal/sys.h: No such file or directory
| #include <metal/sys.h>
| ^~~~~~~~~~~~~
| compilation terminated.
| make: *** [<builtin>: rfdc_functions.o] Error 1
| In file included from clock_interface.h:38:0,
| from clock_interface.c:34:
| xrfdc.h:284:10: fatal error: metal/sys.h: No such file or directory
| #include <metal/sys.h>
| ^~~~~~~~~~~~~
| compilation terminated.
| make: *** [<builtin>: clock_interface.o] Error 1
| In file included from rfdc_functions.h:37:0,
| from data_interface.h:40,
| from data_interface.c:34:
| xrfdc.h:284:10: fatal error: metal/sys.h: No such file or directory
| #include <metal/sys.h>
| ^~~~~~~~~~~~~
| compilation terminated.
| make: *** [<builtin>: data_interface.o] Error 1
| ERROR: oe_runmake failed
| WARNING: /home/sudhakar/Desktop/zcu111_xrfdc/build/tmp/work/aarch64-xilinx-linux/zero-driver/1.0-r0/temp/run.do_compile.1007:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_compile (log file is located at /home/sudhakar/Desktop/zcu111_xrfdc/build/tmp/work/aarch64-xilinx-linux/zero-driver/1.0-r0/temp/log.do_compile.1007)
ERROR: Task (/home/sudhakar/Desktop/zcu111_xrfdc/project-spec/meta-user/recipes-apps/zero-driver/zero-driver.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3265 tasks of which 3264 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
/home/sudhakar/Desktop/zcu111_xrfdc/project-spec/meta-user/recipes-apps/zero-driver/zero-driver.bb:do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
ERROR: Failed to build project

----------------------------

Any quick help is greately appreciated. Please let me know if any additional information is needed. Thanks in advance,

Sudhakar

0 Kudos
7 Replies
stephenm
Xilinx Employee
Xilinx Employee
397 Views
Registered: ‎09-12-2007

Have you set the DEPENDS in your application BB file to libmetal? this will ensure that the libmetal is built before your app

The wiki below covers this topic. It is for 2018.3 SDK, however, same should apply to you in 2019.2

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/70254659/Creating+Linux+application+targeting+the+RFDC+driver+in+SDK+2018.3

0 Kudos
sudhakarb
Visitor
Visitor
378 Views
Registered: ‎11-21-2019

Yes. I have added DEPENDS already. I want to create this as a shared library and hence not going for do_install section.

Following is my bitbake file:

--------------------------------------

SUMMARY = "Build Zero Driver"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://spyrft.c \
file://board.h \
file://xrfdc.h \
file://xrfdc_hw.h \
file://clock_interface.h \
file://clock_interface.c \
file://common.h \
file://common.c \
file://data_interface.h \
file://data_interface.c \
file://rfdc_functions.h \
file://rfdc_functions.c \
file://rfdc_interface.h \
file://rfdc_interface.c \
file://Makefile \
"

S = "${WORKDIR}"

DEPENDS = "libmetal"
DEPENDS = "rfdc"
DEPENDS = "soapysdr"

PROVIDES = "libspyrft"

FILES_${PN} = "${libdir}/SoapySDR/modules0.8/libspyrft.so"

----------------------------------------------------------------

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
368 Views
Registered: ‎09-12-2007

Do you have the libmetal enabled in the rootfs?

0 Kudos
sudhakarb
Visitor
Visitor
357 Views
Registered: ‎11-21-2019

yes. I have it enabled.

sudhakarb_0-1621433414765.png

 

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
327 Views
Registered: ‎09-12-2007

Can you share you Makefile, does it have the libmetal (-lmetal) library added to the linker?

 

0 Kudos
sudhakarb
Visitor
Visitor
290 Views
Registered: ‎11-21-2019

Sorry..Seems I missed the attachment in my first message.. I tried different combinations to link libmetal and rfdc.. As I mentioned, my goal is to call the rfdc functionality inside C++. My petalinux project is a C++ project. It was failing to take libmetal and rfdc. So I started with C code in the same C++ project. I suspect if that could be a contributor to the issue. Here is my makefile with C++ related sections commented out:

---------------------

APP = spyrft

TARGET_LIB = libspyrft.so # target lib

# Add any other object files to this list below
SRCSCPP=$(wildcard *.cpp)
SRCSC=$(wildcard *.c)

#APP_OBJSCPP = $(SRCSCPP:.cpp=.o)
APP_OBJSC = $(SRCSC:.c=.o)

LDLIBS1 = -lmetal
LDLIBS2 = -lrfdc
LDLIBS3 = -lSoapySDR

# LDLIBS1 = /home/sudhakar/Desktop/rootfs/usr/lib/librfdc.so.*
# LDLIBS2 = /home/sudhakar/Desktop/rootfs/usr/lib/libmetal.so.*
# LDLIBS3 = /home/sudhakar/Desktop/rootfs/usr/lib/SoapySDR.so.*


CC = gcc

CFLAGS = -Wall

.PHONY: all

all: $(TARGET_LIB)

#$(TARGET_LIB): $(APP_OBJSC) $(APP_OBJSCPP)
#$(CC) $(LDFLAGS) -o $@ $(APP_OBJSC) $(LDLIBS1) $(LDLIBS2)
#$(CXX) -o $@ $(APP_OBJSCPP) $(CFLAGS) $(LDLIBS3)

$(TARGET_LIB): $(APP_OBJSC)
$(CC) $(LDFLAGS) -o $@ $(APP_OBJSC) $(LDLIBS1) $(LDLIBS2)

clean:
-rm -f $(TARGET_LIB) *.elf *.gdb *.o

###############################################

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
262 Views
Registered: ‎09-12-2007

You need to add the (-L) include directory

0 Kudos