Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RISC-V architecture #12

Open
sidharthasajeev2000 opened this issue Nov 21, 2023 · 9 comments
Open

RISC-V architecture #12

sidharthasajeev2000 opened this issue Nov 21, 2023 · 9 comments

Comments

@sidharthasajeev2000
Copy link

Hi
Is it possible to cross-compile the source code for RISC-V Architecture?

@mpromonet
Copy link
Owner

Hi,
It should.
Best Regards
Michel

@sidharthasajeev2000
Copy link
Author

sidharthasajeev2000 commented Nov 24, 2023

Hi,I tried to compile with my cross-compiler like I did for v4l2rtspserver . But I think it only compiles the v4l2rtspserver part in the onvif folder not the other files and gave me this.

/usr/bin/ld: liblibv4l2rtspserver.a(BasicTaskScheduler.cpp.o): Relocations in generic ELF (EM: 243)
/usr/bin/ld: liblibv4l2rtspserver.a(BasicTaskScheduler.cpp.o): Relocations in generic ELF (EM: 243)
/usr/bin/ld: liblibv4l2rtspserver.a(BasicTaskScheduler.cpp.o): Relocations in generic ELF (EM: 243)
/usr/bin/ld: liblibv4l2rtspserver.a(BasicTaskScheduler.cpp.o): Relocations in generic ELF (EM: 243)
/usr/bin/ld: liblibv4l2rtspserver.a(BasicTaskScheduler.cpp.o): Relocations in generic ELF (EM: 243)
/usr/bin/ld: liblibv4l2rtspserver.a(BasicTaskScheduler.cpp.o): Relocations in generic ELF (EM: 243)
/usr/bin/ld: liblibv4l2rtspserver.a: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make: *** [Makefile:76: onvif-server.exe] Error 1

Do you know,what should i do?

@didomenico
Copy link
Contributor

didomenico commented Dec 1, 2023

It is possible, I have done it. From your error message, it looks like your libv4l2rtspserver was built for the host architecture instead of risc-v. The cross compiling flags are not relayed to some of the dependencies, including v4l2rtspserver. You have to look at the Makefiles and use the commands of the targets manually to build it.
These were the commands I used to build liblibrtspserver.a:

git submodule update --recursive --init v4l2rtspserver
cd v4l2rtspserver && cmake -DALSA=OFF -DCMAKE_CXX_FLAGS=-I[openssl/ssl.h folder] -DCMAKE_CXX_COMPILER=your-riscv-c++-cross-compiler -DCMAKE_C_COMPILER=your-riscv-c-cross-compiler
make libv4l2rtspserver

@sidharthasajeev2000
Copy link
Author

riscv64-eyenix-linux-gnu-c++ -std=c++11 -g2 -I inc -I ws-discovery/gsoap/ -I gen -I /usr/include -I /usr/share/gsoap/plugin -DWITH_DOM -DWITH_OPENSSL -DSOAP_PURE_VIRTUAL -fpermissive -pthread -DVERSION="a59b554-dirty" -I v4l2rtspserver/live/groupsock/include -I v4l2rtspserver/live/liveMedia/include -I v4l2rtspserver/live/UsageEnvironment/include -I v4l2rtspserver/live/BasicUsageEnvironment/include -I v4l2rtspserver/inc -I v4l2rtspserver/libv4l2cpp/inc -c -o src/onvif-server.o src/onvif-server.cpp
In file included from /usr/include/ctype.h:39,
from /opt/riscv/eyenix/riscv64-eyenix-linux-gnu/include/c++/10.1.0/cctype:42,
from /opt/riscv/eyenix/riscv64-eyenix-linux-gnu/include/c++/10.1.0/bits/localefwd.h:42,
from /opt/riscv/eyenix/riscv64-eyenix-linux-gnu/include/c++/10.1.0/ios:41,
from /opt/riscv/eyenix/riscv64-eyenix-linux-gnu/include/c++/10.1.0/istream:38,
from /opt/riscv/eyenix/riscv64-eyenix-linux-gnu/include/c++/10.1.0/sstream:38,
from src/onvif-server.cpp:20:
/opt/riscv/eyenix/sysroot/usr/include/bits/endian.h:2:3: error: #error "Never use <bits/endian.h> directly; include <endian.h> instead."
2 | # error "Never use <bits/endian.h> directly; include <endian.h> instead."

what file should I edit to rectify it?

@sidharthasajeev2000
Copy link
Author

when making the new repository v4l2rtspserver builds in rsicV rest are being build in x86 .This causes linking problem.so we edited the make file a bit a got the above response.

we hardcoded CC and CXX

-DCMAKE_CXX_COMPILER=riscv64-eyenix-linux-gnu-c++ -DCMAKE_C_COMPILER=riscv64-eyenix-linux-gnu-gcc

and made changes here also

#SYSROOT?=$(shell $(CXX) --print-sysroot)
CXX:=riscv64-eyenix-linux-gnu-c++

@mpromonet
Copy link
Owner

Hi,

Did you try ?

make CC=riscv64-eyenix-linux-gnu-gcc CXX=riscv64-eyenix-linux-gnu-g++

Best Regards,
Michel.

@sidharthasajeev2000
Copy link
Author

it provided me with this error
PREFIX=/usr SYSROOT=/opt/riscv/eyenix/bin/../sysroot DESTDIR=/usr/bin
VERSION=a59b554
mkdir -p gen
/opt/riscv/eyenix/bin/../sysroot/usr/bin/wsdl2h -d -Ntev -W -L -o gen/onvif.h wsdl/b-2.xsd wsdl/bf-2.xsd wsdl/bw-2.wsdl wsdl/common.xsd wsdl/deviceio.wsdl wsdl/devicemgmt.wsdl wsdl/display.wsdl wsdl/event.wsdl wsdl/imaging.wsdl wsdl/include wsdl/media.wsdl wsdl/onvif.xsd wsdl/ptz.wsdl wsdl/r-2.xsd wsdl/receiver.wsdl wsdl/recording.wsdl wsdl/replay.wsdl wsdl/rw-2.wsdl wsdl/search.wsdl wsdl/t-1.xsd
make: /opt/riscv/eyenix/bin/../sysroot/usr/bin/wsdl2h: No such file or directory
make: *** [Makefile:44: gen/onvif.h] Error 127

@mpromonet
Copy link
Owner

Hi,

You need to specify GSOAP_BIN to get wsdl2h from the host, something like:

make CC=riscv64-eyenix-linux-gnu-gcc CXX=riscv64-eyenix-linux-gnu-g++ GSOAP_BIN=/usr/bin

Best Regards,
Michel.

@sidharthasajeev2000
Copy link
Author

hi While cross-compiling i am encountering problems with gsoap should I try and cross compile it for my project and then do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants