make: *** 没有指明目标并且找不到 makefile。 停止。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了make: *** 没有指明目标并且找不到 makefile。 停止。相关的知识,希望对你有一定的参考价值。
liuxu@ubuntu:~$ cd 下载
liuxu@ubuntu:~/下载$ cd pidgin-lwqq-master
liuxu@ubuntu:~/下载/pidgin-lwqq-master$ mkdir build
liuxu@ubuntu:~/下载/pidgin-lwqq-master$ cd build
liuxu@ubuntu:~/下载/pidgin-lwqq-master/build$ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - 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
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- checking for module 'purple'
-- found purple, version 2.10.6
-- checking for module 'glib-2.0'
-- found glib-2.0, version 2.34.1
-- checking for module 'mozjs185'
-- package 'mozjs185' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
CMakeLists.txt:19 (pkg_check_modules)
CMake Warning at CMakeLists.txt:20 (find_package):
By not providing "FindEV.cmake" in CMAKE_MODULE_PATH this project has asked
CMake to find a package configuration file provided by "EV", but CMake did
not find one.
Could not find a package configuration file provided by "EV" with any of
the following names:
EVConfig.cmake
ev-config.cmake
Add the installation prefix of "EV" to CMAKE_PREFIX_PATH or set "EV_DIR" to
a directory containing one of the above files. If "EV" provides a separate
development package or SDK, be sure it has been installed.
libpurple version:2.10.6
-- Found Gettext: /usr/bin/msgmerge (found version "0.18.1")
CMake Warning (dev) at CMakeLists.txt:94 (add_subdirectory):
The source directory
/home/liuxu/下载/pidgin-lwqq-master/liblwqq
does not contain a CMakeLists.txt file.
CMake does not support this case but it used to work accidentally and is
being allowed for compatibility.
Policy CMP0014 is not set: Input directories must have CMakeLists.txt. Run
"cmake --help-policy CMP0014" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
/usr/share/
===============================================
-- With Libev (Option) : 0
-- Native Language Support : true
-- Install Path : /usr/lib/purple-2
===============================================
-- Configuring incomplete, errors occurred!
liuxu@ubuntu:~/下载/pidgin-lwqq-master/build$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
-- package 'mozjs185' not found
装了mozjs185再说本回答被提问者采纳
在 cmake 中编译链接器脚本 - 找不到目标文件(嵌入式项目)
【中文标题】在 cmake 中编译链接器脚本 - 找不到目标文件(嵌入式项目)【英文标题】:Compile linker script in cmake - cannot find object file (embedded project) 【发布时间】:2015-04-18 14:28:48 【问题描述】:我的问题是我想从这个项目的普通 makefile 做一个 cmake 文件: https://github.com/brianwiddas/pi-baremetal
我创建了 CMakeLists 文件,但在链接项目时遇到了问题。在 make 命令之后,我有一个这样的错误:
Linking C executable rpi-0.1.elf
/usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: cannot find start.o
collect2: error: ld returned 1 exit status
make[2]: *** [rpi-0.1.elf] Błąd 1
make[1]: *** [CMakeFiles/rpi.dir/all] Błąd 2
链接器代码片段:
MEMORY
initsys : org = 0x8000, len = 1M
kernel : org = 0xf0000000, len = 1M
data : org = 0xc0000000, len = 1M
SECTIONS
/* Initial section, loads/runs at 0x8000 */
.init :
start.o(.text* .data* .bss* .rodata*)
initsys.o (.text* .data* .bss* .rodata*)
>initsys
//the rest of code in SECTION
我意识到cmake创建带有“.c.obj/.s.obj”扩展名的目标文件,与这个带有“.o”扩展名的makefile比较,我在链接器代码中对其进行了更改,但现在错误是:
cannot find start.s.obj
现在我不知道出了什么问题。可能是因为在 makefile 项目中,源代码文件和目标文件在同一个文件夹中。 Cmake 在另一个文件夹中创建目标文件,在我的情况下:
source files folder - ../Projekt/code
object files folder - ../Projekt/build/CMakeFiles/rpi.dir/code
也许链接描述文件看不到目标文件,因为它们在另一个文件夹中。 build 文件夹由 cmake 自动创建。
这是我的 CMakeLists.txt 文件:
## Minimal cmake version
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
## Project name
project(rpi C CXX ASM)
## Project version
set($PROJECT_NAME_version "0.1")
## Project options
option(DISABLE_NEWLIB_SUPPLIED_SYSCALLS "Disables pre-defined libraries for ARM" ON)
## Compilation options
set(CMAKE_C_FLAGS "$CMAKE_C_FLAGS -Wall -O6 -nostdinc -ffreestanding -marm -mcpu=arm1176jzf-s")
## Creation of the necessary definitions
if (DISABLE_NEWLIB_SUPPLIED_SYSCALLS)
add_definitions(-DDISABLE_NEWLIB_SUPPLIED_SYSCALLS)
endif (DISABLE_NEWLIB_SUPPLIED_SYSCALLS)
## Assembler source code
set(ASM_SOURCE_FILES $PROJECT_SOURCE_DIR/code/start.s)
## C source code
set(C_SOURCE_FILES $PROJECT_SOURCE_DIR/code/atags.c
$PROJECT_SOURCE_DIR/code/atags.h
$PROJECT_SOURCE_DIR/code/barrier.h
$PROJECT_SOURCE_DIR/code/divby0.c
$PROJECT_SOURCE_DIR/code/framebuffer.c
$PROJECT_SOURCE_DIR/code/framebuffer.h
$PROJECT_SOURCE_DIR/code/interrupts.c
$PROJECT_SOURCE_DIR/code/interrupts.h
$PROJECT_SOURCE_DIR/code/led.c
$PROJECT_SOURCE_DIR/code/led.h
$PROJECT_SOURCE_DIR/code/initsys.c
$PROJECT_SOURCE_DIR/code/mailbox.c
$PROJECT_SOURCE_DIR/code/mailbox.h
$PROJECT_SOURCE_DIR/code/main.c
$PROJECT_SOURCE_DIR/code/memory.c
$PROJECT_SOURCE_DIR/code/memory.h
$PROJECT_SOURCE_DIR/code/memutils.c
$PROJECT_SOURCE_DIR/code/memutils.h
$PROJECT_SOURCE_DIR/code/teletext.h
$PROJECT_SOURCE_DIR/code/textutils.c
$PROJECT_SOURCE_DIR/code/textutils.h)
## Additional files
set(OTHER_FILES $PROJECT_SOURCE_DIR/code/linker.ld)
## Create an executable binary files
add_executable($PROJECT_NAME $ASM_SOURCE_FILES $C_SOURCE_FILES)
## Settings resulting executable file
set_target_properties($PROJECT_NAME PROPERTIES OUTPUT_NAME "$PROJECT_NAME-$$PROJECT_NAME_version.elf")
set_target_properties($PROJECT_NAME PROPERTIES LINK_FLAGS "-Wl,-Map,$CMAKE_BINARY_DIR/$PROJECT_NAME-$$PROJECT_NAME_version.map -T $PROJECT_SOURCE_DIR/code/linker.ld -nostdlib -nostartfiles -gc-sections")
## Creates a kernel image
add_custom_command(TARGET $PROJECT_NAME COMMAND $CROSS_COMPILER_PREFIXobjcopy $CMAKE_BINARY_DIR/$PROJECT_NAME-$$PROJECT_NAME_version.elf -O binary $CMAKE_BINARY_DIR/$PROJECT_NAME-$$PROJECT_NAME_version.img)
和toolchain-raspberry-pi.cmake文件:
## Determination of the operating system on which the program is designed
set(CMAKE_SYSTEM_NAME Generic)
## The term architecture on which the program is established
set($PROJECT_NAME_architecture raspberry-pi)
## Prefix tools used for cross-compiling
set(CROSS_COMPILER_PREFIX arm-none-eabi-)
## Compilers that will be used.
include (CMakeForceCompiler)
cmake_force_c_compiler($CROSS_COMPILER_PREFIXgcc GNU)
cmake_force_cxx_compiler($CROSS_COMPILER_PREFIXg++ GNU)
如何修复此错误以及为什么 cmake 不创建带有“.o”扩展名的目标文件,并且与源代码位于同一文件夹中? 请帮忙。
解决方案:
在链接器脚本中,我在 start.s.obj/initsys.c.obj 之前添加 *,如下所示:
*start.s.obj (.text* .data* .bss* .rodata*)
*initsys.c.obj (.text* .data* .bss* .rodata*)
【问题讨论】:
【参考方案1】:你能在链接器文件中尝试*start*.o(.text* .data* .bss* .rodata*)
吗?
PS:我无法编译您的项目。我猜您正在使用 arm-none-eabi-* 工具链进行交叉编译。你如何覆盖默认编译器?
【讨论】:
你使用的是windows还是linux平台?如果上述解决方案不起作用并且您正在使用 Windows 尝试将*.start*.o
替换为 *start*.obj
嗨,感谢您的帮助,我添加 * 并且现在可以工作了:] 我通过将此行添加到 toolchain-raspberry-pi.cmake 文件来覆盖默认编译:set(CROSS_COMPILER_PREFIX arm-none-eabi-)
以上是关于make: *** 没有指明目标并且找不到 makefile。 停止。的主要内容,如果未能解决你的问题,请参考以下文章
make: *** 没有指明目标并且找不到 makefile。 停止
源码编译nginx的时候,出现“make: *** 没有指明目标并且找不到 makefile。 停止“。的报错的解决方法
make: *** 没有指明目标并且找不到 makefile。 停止。
make: *** 没有指明目标并且找不到 makefile. 停止.