Vitis PetaLinux build cant fetch required files while building an application project - makefile

I want to build a PetaLinux Image for my Ultra96v2.
I followed this guide up until building my application project in Vitis. It looks promising but then while building the application project for my custom platform, Vitis throws this error:
18:08:28 **** Incremental Build of configuration Debug for project dpu_appl_system ****
make all
Generating bif file for the system project
Executing command '::scw::generate_bif -xpfm /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_demo/export/dpu_demo/dpu_demo.xpfm -domains linux_domain -bifpath /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/system.bif' on XSCT
sdcard_gen --xpfm /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_demo/export/dpu_demo/dpu_demo.xpfm --sys_config dpu_demo --bif /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/system.bif --bitstream /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl/_ide/bitstream/dpu_hardware.bit --sd_file /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl/Debug/dpu_appl.elf
creating BOOT.BIN using /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl/_ide/bitstream/dpu_hardware.bit
Running /home/user/Xilinx/Vitis/2021.2/bin/bootgen -arch zynqmp -image /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif -w -o i BOOT.BIN
ERROR:BootGen - syntax error
Line #13, "/media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif".
... emo/sw/atf,dpu_demo/boot/bl31.elf
^
[ERROR] : BIF file parsing failed with code 1
Error writing SD card data : Error when running '/home/user/Xilinx/Vitis/2021.2/bin/bootgen -arch zynqmp -image /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif -w -o i BOOT.BIN'
make: *** [makefile:42: package] Error 1
18:08:36 Build Finished (took 7s.643ms)
It specifically shows me, that there is a comma in the path where it searches for the file. The files are available
at the "normal" location, without the "atf,", "dtb,", etc
at the "weird" location. I created the path so the requested path exists for every file that throws an error message, like
/media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif". ... emo/sw/atf,dpu_demo/boot/bl31.elf
I created the path with the weird artefact "arf,dpu_demo", with the komma in the path, but still it wont work. Is this some kind of problem with Vitis, like some env variables not set correctly, or is the building mechanism just acting weird? I cant resolve this issue, because I am not able to change the paths it is supposed to look for the files. This hinders me in advancing my project. I work on Ubuntu 20.04.
Can anyone help me out here, please? I would really appreciate it!
I asked this question in the Xilinx Community, too, but unfortunately there was no resonance at all.
Thank you so much in advance!

PLEASE READ THE WHOLE ANSWER FOR ACTUAL SOLUTION
I think I got it now, though I did not verify whether the image actually works on my Ultra96v2, yet.
I noticed, that the weird path with commata is inside of the boot.bif and system.bif.
So the first time I tried to build it, the bif wasnt there, but got created (I assume). The bif was ready then but only had a weird path inside, so I took the makefile (you can find it in debug/sd_card), copied it, and just commented out the line GENERATE_BIF_XSCT_CMD = ${GENERATE_BIF} -xpfm ${XPFM_PATH} -domains ${DOMAINS} -bifpath ${BIF_PATH}.
Then I edited the boot.bif and system.bif and changed the atf,boot, uboot,boot, and dts,boot to just boot, so the BootGen wouldnt look into the directories with the commata anymore, but only the boot-directory which was specified.
Once that was set up, I executed the edited makefile in my console, by going into the sd_card-directory and executing the following command:
make -f <your_edited_makefile>
This means, that you cant press "build" in Vitis, it wont work. You build the content on your own and wont get a green check mark beside the project! Then the sd_card-directory was populated with (I assume) all necessary data to boot the Ultra96v2 from SD card. This was the content:
boot.scr
BOOT.BIN
dpu_appl.elf (your application project name, I guess)
README.txt
system.dtb
The underlying issue seem to have been that the ::scw::generate_bif created a path to look after, which didnt exist. Really weird issue, in my opinion.
UPDATE:
I just made some changes to the PetaLinux config with the petalinux-config command and rebuilt everything. Once I go to the Vitis part, I changed the system.bif within Vitis itself, and the project compiled successfully, also populating the sd_card directory, as it seems.
UPDATE 2:
Everything failed, so I tried to get to the *.bif of the Application System project. I opened it (linux.bif) and edited the "atf,", "dtb," and "uboot," out of it. Since this is only created once and references by the following files, this fixed my issue and the build was completed successfully in Vitis. So just ignore my originial answer and update.
I hope this is working and hope it will help some of you.

Related

Error while generating grpc files (--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.)

I’m trying to run the following command to generate grpc files:
protoc --proto_path=$PROTO_PATH --plugin=protoc-gen-grpc=$PLUGIN_GRPC --grpc_out=$OUT/grpc $PROTO_FILES
This results in the following error:
/Users/MYUSERNAME/Downloads/protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
I made sure the file from the error message is located at that path and has also the correct permissions.
-rwxrwxrwx# 1 MYUSERNAME staff 6334176 10 Aug 00:03 protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe
I also tried running the command as sudo.
Generating java or kotlin files with --java_out=$OUT/java --kotlin_out=$OUT/kotlin
works perfectly fine, so the problem is --grpc_out=$OUT/grpc
I also downloaded multiple versions of the protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe file but it always results in the same error. I also tried replacing all path variables (e.g. $PROTO_PATH) with their corresponding values, without any effect. I’m using MacBook with M1Pro chip.
The problem is that M1 Macs aren't supported. They have copied over the osx-x86_64 binary and renamed it for osx-aarch_64 as a workaround to make it easier to run with Rosetta. See here for where that change was made and here for the full conversation about supporting M1 Macs.

psqlodbc driver not found on heroku despite being in my app directory

I am trying to get RODBC to work on heroku. I have a rails app that calls an R script from RinRuby, which then queries the production database in order to do some analysis. It all works fine on my local Mac, so I thought the best approach was to use the binary compiled on my Max (psqlodbcw.so) into my repo, and reference it in production as well. Unfortunately, when I try to make the connection in production using this connection string:
> library(RODBC)
> dbhandle <- odbcDriverConnect('driver=./psqlodbcw.so;database=nw_server_production;trusted_connection=true;uid=nw_server')
Warning messages:
1: In odbcDriverConnect("driver=./psqlodbcw.so;database=<db_name>;trusted_connection=true;uid=<user>") :
[RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib './psqlodbcw.so' : file not found
2: In odbcDriverConnect("driver=./psqlodbcw.so;database=<db_name>;trusted_connection=true;uid=<user>?") :
ODBC connection failed
I have seen this error in a similar post online here, but using SQL server instead of postgres. But the accepted answer on that post doesn't explain why the file isn't found, despite being in the app directory. I did follow the same approach and made my own custom buildpack (available here: https://github.com/NovaWulf/r-rodbc-buildpack). I replaced the .so file with the one I compiled on my mac, and simply deleted the .rll file and the code that copies it, since I don't have that file (and hopefully don't need it for psqlodbc?). When I run that buildpack it runs without error on heroku, but then when I reference the .so file copied from the buildpack, I get the same "file not found" error.
Is this happening because the .so file was compiled on the wrong system architecture? I tried compiling psqlodbc on linux, but I do not get a psqlodbcq.so file when I do that (let alone an .rll file). The closest thing I get is a file called libodbcpsqlS.so, which is a setup file, not a driver file.
Could someone please help me understand the best approach to this problem? Why is heroku not seeing the file that is not there? And what is the best solution? Is there a simple way to just download the correct driver file somewhere?
Any help is much appreciated!
Best,
Paul

Trouble Creating and Executing an Intel SGX Enclave

I'm very new to SGX and wanted to start with something simple. Fortunately, I found this very basic tutorial. Unfortunately, as simple as it is, I can't get it to work. The code executes, but there are errors in the output.
[sgx_create_enclavew ..\urts\win\urts.cpp:195] Couldn't open file with CreateFile()
error 0x200f, failed to create enclave.
Buffertests:
Buffer before change: Hello World!
Buffer after change: Hello World!
Stringtests:
Returned Secret:
Saved Secret: My secret string
Load Secret:
Integertests:
secretIntValue first load: 0
saved a 1337 to the enclave.
secretIntValue second load after 1337 was saved: 0
error, failed to destroy enclave.
image of output
the tutorial says:
If you get the error SGX couldn't find the enclave file. The solution is to move the enclave_test_save.signed.dll into the same folder where the app_test_save.exe is located.
which I've tried, but it didn't solve the problem.
when I try to create the enclave using:
sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &updated, &eid, NULL);
it returns: SGX_ERROR_ENCLAVE_FILE_ACCESS
could the problem be a result of using a different version of Visual Studio? (The tutorial uses VS 2012, while I'm using VS 2015)
Did you run the application through command prompt or from IDE?
If you are using IDE, You need to change the debugging properties to $(OutDir) from $(ProjecttDir) under Project Properties->Configuration Properties->Debugging->Working Directory.(Both Enclave and Application) Select the Intel(R) SGX Debugger.
Disclaimer: I had the same error although under a different setting (Ubuntu, eclipse) so I am not sure to what extent this will help.
Before initialize_enclave() is called (which in turn calls sgx_create_enclave()), a chdir(absolutePath) command needs to be executed, where absolutePath needs to be the absolute path to where your executable is.
My error was due to a wrong path I used.
Thanks, I solved it. turns out I had to place enclave_test_save.signed.dll in the root folder with the .edl file and not with the .exe file.

Building RXTX with --disable-locks

I need to build RXTX (http://rxtx.qbang.org/wiki/index.php/Main_Page) for a 64 bit platform with --disable-locks. ( the target platform is a Ubuntu Snappy platform so there is a problem with the permissions and lock files).
The .configure --disable-locks and make seemed to run ok.
I got a new .jar file and librxtxSerial.so as a result.
However when I installed them, I get the following error :
java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver
java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver
Is there something else I need to do?
Are there other object files I need to copy over.
Thanks in advance.
I solved the problem myself.
The problem was that the configure script was not expecting a java version higher than 1.5 as shown here in t he extract :
case $JAVA_VERSION in
1.2*|1.3*|1.4*|1.5*)
#fix_parameters $JPATH/jre/lib/javax.comm.properties
CLASSPATH=".:\$(TOP):\$(TOP)/src:"find $JPATH/ -name RXTXcomm.jar |head -n1
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"jre/lib/ext"
So the paths were not being set up correctly for me.
I changed it to
case $JAVA_VERSION in
1.2*|1.3*|1.4*|1.5*|1.7*)
Then it worked ok.

Code::Blocks debugger shows some other path which isn't included in the project

I'm trying to use code::blocks debugger. I followed this basic tutorial on how to do it. I also watched two videos on you tube. I was actually trying it on a bigger file which had its declaration & implementation in separate files (one was header file tree.h, one had its implementation tree.cpp & the last one had implementation_tree.cpp main function to check the header file) but it didn't work so I tried it on a very simple program. But now debugger shows this error
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: F:\Coding\test\test\
Adding source dir: F:\Coding\test\test\
Adding file: F:\Coding\test\test\bin\Debug\test.exe
Changing directory to: F:/Coding/test/test/.
Set variable: PATH=.;C:\Program Files\CodeBlocks\bin;C:\Program Files\CodeBlocks;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0
[debug]Command-line: F:\Coding\Data Structures\tree.h -nx -fullname -quiet -args F:/Coding/test/test/bin/Debug/test.exe
[debug]Working dir : F:\Coding\test\test
Starting debugger: F:\Coding\Data Structures\tree.h -nx -fullname -quiet -args F:/Coding/test/test/bin/Debug/test.exe
failed
Whatever is in this line [debug]Command-line: is the address of my tree.h file which I was trying to debug earlier. But now I've removed all the breakpoints & everything related to that file from Code::Blocks & even changed that file's location but it still shows that same address in Starting debugger:. I've also rebuilt my test program after deleting everything related to it several times but I'm still getting the same error. I'm using GDB.
I'm so sorry if this question sounds very silly as I'm trying this for the first time & not being able to proceed through any tutorials or any other forum or anything else. I've also seen other related questions on stackoverflow but none of them works for me. So, please help. Thanks.
Settings -> Compiler -> Search Directories.. Delete all paths from there.

Resources