`Exec format error` when cross compiling(v2.0.5 and v2.0.6)
ouonline opened this issue · comments
Hi,
I'm using FlatBuffer v2.0.5 and v2.0.6, compiling for RISCV on Ubuntu18.04 amd64(C++, gcc 7.5.0) and the following error occured :
[ 95%] Linking CXX executable flatc
Running scripts/generate_code.py...
Traceback (most recent call last):
File "scripts/generate_code.py", line 148, in <module>
flatc(
File "scripts/generate_code.py", line 82, in flatc
result = subprocess.run(cmd, cwd=str(cwd), check=True)
File "/usr/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/path/to/build/flatbuffers-build/flatc'
flatbuffers-build/CMakeFiles/flatc.dir/build.make:560: recipe for target 'flatbuffers-build/flatc' failed
while v2.0.0 doesn't have the generate_code.py
message. I guess flatc
is called to generate some code in the newer version but the binary format is wrong(compiled for RISCV but run on amd64).
I see, so you are cross compiling? Does CMAKE set a flag for this that we can skip running the generate_code.py script in that case?
I see, so you are cross compiling? Does CMAKE set a flag for this that we can skip running the generate_code.py script in that case?
I found this issue: #5569 and set FLATBUFFERS_BUILD_TESTS
to OFF
and still had that error, while in v2.0.0 it is OK.
What flags should be added to the build command? Set FLATBUFFERS_BUILD_FLATC
to OFF
? But I want a flatc
for RISCV indeed.
I actually removed the generate_code.py
from the CMAKE file, do you have the latest code?
I actually removed the
generate_code.py
from the CMAKE file, do you have the latest code?
I use v2.0.6 and generate_code.py
is used in https://github.com/google/flatbuffers/blob/v2.0.6/CMakeLists.txt#L555
I actually removed the
generate_code.py
from the CMAKE file, do you have the latest code?
The latest version works. Thanks.