当前位置:网站首页>使用cmake交叉編譯helloworld
使用cmake交叉編譯helloworld
2022-06-13 05:24:00 【藍牙先生】
主機環境
cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
cmake版本
cmake --version
cmake version 3.16.3
helloworld.c
[email protected]:/mnt/lab/cmake_helloworld$ cat helloworld.c
#include <stdio.h>int main(int argc, char *argv[])
{
printf("hello world\n");
return 0;
}
CMakeLists.txt
[email protected]:/mnt/lab/cmake_helloworld$ cat CMakeLists.txt
project(helloworld_project)cmake_minimum_required(VERSION 3.16)
set (CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set (CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)add_executable(helloworld helloworld.c)
執行cmake命令生成Makefile
[email protected]:/mnt/lab/cmake_helloworld$ cmake .
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/lab/cmake_helloworld
執行make命令
[email protected]:/mnt/lab/cmake_helloworld$ make
Scanning dependencies of target helloworld
[ 50%] Building C object CMakeFiles/helloworld.dir/helloworld.c.o
[100%] Linking C executable helloworld
[100%] Built target helloworld
查看生成的helloworld格式
[email protected]:/mnt/lab/cmake_helloworld$ file helloworld
helloworld: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=64931729ed98ba097ffafab33a540e307404aaf9, for GNU/Linux 3.7.0, not stripped
交叉編譯成功
边栏推荐
- The problem of flex layout adaptive failure
- Case - simulated landlords (primary version)
- Windbos run command set
- C language learning log 1.16
- C language learning log 1.22
- Solution to prompt "permission is required to perform this operation" (file cannot be deleted) when win10 deletes a file
- Database design
- Case - grade sorting - TreeSet set storage
- [multithreading] thread pool core class -threadpoolexecutor
- Basic operations of MySQL auto correlation query
猜你喜欢
Binary search and binary answer
float类型取值范围
File descriptorfile description
Explain the opencv function cv:: add() in detail, and attach sample code and running results of various cases
Metaltc4.0 stable release
priority inversion problem
Case - count the number of occurrences of each string in the string
Case - simulated landlords (upgraded version)
Browser screenshot method (long screenshot, node screenshot, designated area screenshot)
Case - simulated landlords (primary version)
随机推荐
First assessment
SQL table columns and statements of database
Explain the opencv function cv:: add() in detail, and attach sample code and running results of various cases
Clause 26: avoid overloading universal reference types
Chapter 18 pagination: Introduction
Clause 31: avoid default capture mode
C language learning log 12.25
MySQL table data modification
How to Algorithm Evaluation Methods
RTSP streaming using easydarwin+ffmpeg
动态规划-最长公共子串
Pyqt5 module
[thread / multithread] execution sequence of threads
C language learning log 10.5
Celery understands
Chapter 13 abstraction: address space
Wang Dao Chapter II linear table exercises
Deleted the jupyter notebook in the jupyter interface by mistake
metaRTC4.0集成ffmpeg编译
Clause 28: understanding reference folding