Closed firmwarecostum closed 10 months ago
You must run prepare_cross_compiling
target with a native compiler before building with CMAKE_CROSSCOMPILING. It is impossible to launch binaries and generate source files during crosscompilation.
hy @levlam
I've tried adding prepare_cross_compiling in my Makefile but that command is not there. currently openwrt uses ninja
If you look at the log above when building TD, that's how OpenWRT works when building TD. Is it possible that this command error does not have prepare_cross_compiling because OpenWRT uses Ninja
You must build prepare_cross_compiling
with a native compiler and not with a cross-compiler.
have you tested building this source with ninja?
Yes.
@levlam
are you sure?
ninja: error: unknown target 'prepare_cross_compiling'
Because you must build prepare_cross_compiling with a native compiler and not with a cross-compiler.
cmake
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
<dir> = Project binary directory to be built.
--parallel [<jobs>], -j [<jobs>]
= Build in parallel using the given number of jobs.
If <jobs> is omitted the native build tool's
default number is used.
The CMAKE_BUILD_PARALLEL_LEVEL environment variable
specifies a default parallel level when this option
is not given.
--target <tgt>..., -t <tgt>...
= Build <tgt> instead of default targets.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
--verbose, -v = Enable verbose output - if supported - including
the build commands to be executed.
-- = Pass remaining options to the native tool.
ninja
usage: ninja [options] [targets...]
if targets are unspecified, builds the 'default' target (see manual).
options:
--version print ninja version ("1.11.1")
-v, --verbose show all command lines while building
--quiet don't show progress status, just command output
-C DIR change to DIR before doing anything else
-f FILE specify input build file [default=build.ninja]
-j N run N jobs in parallel (0 means infinity) [default=3 on this system]
-k N keep going until N jobs fail (0 means infinity) [default=1]
-l N do not start new jobs if the load average is greater than N
-n dry run (don't run commands but act like they succeeded)
-d MODE enable debugging (use '-d list' to list modes)
-t TOOL run a subtool (use '-t list' to list subtools)
terminates toplevel options; further flags are passed to the tool
-w FLAG adjust warnings (use '-w list' to list warnings)
Run
mkdir build-native
cd build-native
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target prepare_cross_compiling
cd ..
before running cross-compilation build.
@levlam
The problem is that prepare_cross_compiling cannot be called when building. is there any idea to change cmakelist.txt so that cross compilation can be done without doing prepare_cross_compiling command
thank you for your patience
I already told three times that the target exists, must be build before cross compilation, and even show you exact commands for target building. "It is impossible to launch binaries and generate source files during crosscompilation." Hence there is no way to do cross compilation without doing prepare_cross_compiling beforehand.
can you add CMAKE_CROSSCOMPILING to make cross compilation easier. so the command when building td
cmake -DCMAKE_CROSSCOMPILING
and no longer using theprepare_cross_compiling
tried building this in openwrt. or maybe you have an idea to change CMakeLists.txt to run cross compilation i include logs when i build td which fails