- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想编写一个使用 Trilinos 的简单程序。在配置脚本出现许多问题后,我设法编写了它,因此它可以毫无问题地启动。问题是,当我尝试编译自己的代码(Makefile 和我根据原始示例重写的测试程序)时,它会抛出错误:
c++: error trying to exec '/usr/lib/gcc/x86_64-linux-gnu/4.9/cc1plus': execv: Argument list too long
所以我尝试用 env -i make
启动我的 Makefile 来为“参数”腾出足够的空间。它有效,但现在它抛出另一个错误:
c++: error trying to exec 'cc1plus': execvp: No such file or directory
Makefile:62: recipe for target 'test.o' failed
make: *** [test.o] Error 1
我已经尝试找到解决这个问题的方法,但到目前为止我没有找到任何有效的方法。
gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ (Ubuntu 4.9.1-16ubuntu6) 4.9.1
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sudo aptitude reinstall g++-4.9
仍然没有成功。
g++
命令是否指向正确的目的地:martin@martin-Aspire-E1-531:~$ which g++
/usr/bin/g++
/usr/bin/g++
是指向文件 g++-4.9
的链接,这是启动编译器的正确文件。
所以,我不知道我应该知道什么才能正确编译它。你呢?
#!/bin/bash
# Set this to the root of your Trilinos source directory.
TRILINOS_SOURCE_PATH=~/Stazene/trilinos-11.12.1-Source
#
# You can invoke this shell script with additional command-line
# arguments. They will be passed directly to CMake.
#
EXTRA_ARGS=$@
#
# Each invocation of CMake caches the values of build options in a
# CMakeCache.txt file. If you run CMake again without deleting the
# CMakeCache.txt file, CMake won't notice any build options that have
# changed, because it found their original values in the cache file.
# Deleting the CMakeCache.txt file before invoking CMake will insure
# that CMake learns about any build options you may have changed.
# Experience will teach you when you may omit this step.
#
rm -f CMakeCache.txt
#
# Enable all primary stable Trilinos packages.
#
cmake \
-D CMAKE_INSTALL_PREFIX:FILEPATH="~/.trilinos" \
-D CMAKE_BUILD_TYPE:STRING=DEBUG \
-D CMAKE_C_COMPILER=/usr/bin/mpicc \
-D CMAKE_CXX_COMPILER=/usr/bin/mpicxx \
-D CMAKE_Fortran_COMPILER=/usr/bin/mpif90 \
-D TPL_ENABLE_MPI:BOOL=ON \
-D MPI_BASE_DIR:FILEPATH="/usr/include/mpi" \
-D MPI_EXEC:FILEPATH="/usr/include/mpiexec" \
-D Boost_INCLUDE_DIRS="/usr/include/boost" \
-D Trilinos_ENABLE_Fortran:BOOL=OFF \
-D Trilinos_ENABLE_SECONDARY_TESTED_CODE=ON \
-D Trilinos_ENABLE_TESTS:BOOL=ON \
-D Trilinos_ENABLE_Epetra=ON \
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=ON \
$EXTRA_ARGS \
$TRILINOS_SOURCE_PATH
# CMAKE File for "MyApp" application building against an installed Trilinos
#This file is an adaptation of the CMakeLists.txt file that was converted from
#the buildAgainstTrilinos example. This Makefile was designed to be used in a
#flat directory structure. If you would like to run this example you will need
#put this file and src_file.cpp, src_file.hpp, main_file.cpp from
#buildAgainstTrilinos into a new directory. You will then need to set the
#environment variable MYAPP_TRILINOS_DIR to point to your base installation of
#Trilinos. Note that this example assumes that the installation of Trilinos that
#you point to has Epetra enabled.
# Get Trilinos as one entity
include ~/.trilinos/Makefile.export.Trilinos
# Make sure to use same compilers and flags as Trilinos
CXX_WITH_ECHO=$(Trilinos_CXX_COMPILER)
CXX_WITHOUT_ECHO=@$(Trilinos_CXX_COMPILER)
CXX=$(CXX_WITHOUT_ECHO)
CC=$(Trilinos_C_COMPILER)
FORT=$(Trilinos_Fortran_COMPILER)
CXX_FLAGS=$(Trilinos_CXX_COMPILER_FLAGS) $(USER_CXX_FLAGS)
C_FLAGS=$(Trilinos_C_COMPILER_FLAGS) $(USERC_FLAGS)
FORT_FLAGS=$(Trilinos_Fortran_COMPILER_FLAGS) $(USER_FORT_FLAGS)
INCLUDE_DIRS=$(Trilinos_INCLUDE_DIRS) $(Trilinos_TPL_INCLUDE_DIRS)
LIBRARY_DIRS=$(Trilinos_LIBRARY_DIRS) $(Trilinos_TPL_LIBRARY_DIRS)
LIBRARIES=$(Trilinos_LIBRARIES) $(Trilinos_TPL_LIBRARIES)
LINK_FLAGS=$(Trilinos_EXTRA_LD_FLAGS)
#just assuming that epetra is turned on.
DEFINES=-DMYAPP_EPETRA
default: build_all
# Echo trilinos build info just for fun
info:
@echo "\nFound Trilinos! Here are the details: "
@echo " Trilinos_VERSION = $(Trilinos_VERSION)"
@echo " Trilinos_PACKAGE_LIST = $(Trilinos_PACKAGE_LIST)"
@echo " Trilinos_LIBRARIES = $(Trilinos_LIBRARIES)"
@echo " Trilinos_INCLUDE_DIRS = $(Trilinos_INCLUDE_DIRS)"
@echo " Trilinos_LIBRARY_DIRS = $(Trilinos_LIBRARY_DIRS)"
@echo " Trilinos_TPL_LIST = $(Trilinos_TPL_LIST)"
@echo " Trilinos_TPL_INCLUDE_DIRS = $(Trilinos_TPL_INCLUDE_DIRS)"
@echo " Trilinos_TPL_LIBRARIES = $(Trilinos_TPL_LIBRARIES)"
@echo " Trilinos_TPL_LIBRARY_DIRS = $(Trilinos_TPL_LIBRARY_DIRS)"
@echo " Trilinos_BUILD_SHARED_LIBS = $(Trilinos_BUILD_SHARED_LIBS)"
@echo "End of Trilinos details\n"
build_all: test.out
@echo "CXX_FLAGS: $(CXX_FLAGS)"
# build the
test.out: test.o
$(CXX) $(CXX_FLAGS) test.cpp -o test.out $(LINK_FLAGS) $(INCLUDE_DIRS) $(DEFINES) $(LIBRARY_DIRS) $(LIBRARIES)
test.o:
$(CXX) -c $(CXX_FLAGS) $(INCLUDE_DIRS) $(DEFINES) test.cpp
.PHONY: clean
clean:
rm -f *.o *.a *.exe *.out
//
// This example includes conditional MPI initialization, getting an
// Epetra communicator wrapper, and printing out Epetra version
// information.
//
// This defines useful macros like HAVE_MPI, which is defined if and
// only if Epetra was built with MPI enabled.
#include <Epetra_config.h>
#ifdef HAVE_MPI
// Your code is an existing MPI code, so it presumably includes mpi.h directly.
# include <mpi.h>
// Epetra's wrapper for MPI_Comm. This header file only exists if
// Epetra was built with MPI enabled.
# include <Epetra_MpiComm.h>
#else
# include <Epetra_SerialComm.h>
#endif // HAVE_MPI
#include <Epetra_Version.h>
//
// ... Your other include files go here ...
//
// Do something with the given communicator. In this case, we just
// print Epetra's version to the given output stream, on Process 0.
void exampleRoutine (const Epetra_Comm& comm, std::ostream& out) {
if (comm.MyPID () == 0) {
// On (MPI) Process 0, print out the Epetra software version.
out << Epetra_Version () << std::endl << std::endl;
}
}
int main (int argc, char *argv[]) {
// These "using" declarations make the code more concise, in that
// you don't have to write the namespace along with the class or
// object name. This is especially helpful with commonly used
// things like std::endl.
using std::cout;
using std::endl;
#ifdef HAVE_MPI
// Start up MPI, if using MPI. Trilinos doesn't have to be built
// with MPI; it's called a "serial" build if you build without MPI.
//
// It's bad form to ignore the error codes returned by MPI
// functions, but we do so here for brevity.
(void) MPI_Init (&argc, &argv);
cout << "MPI ok" << endl;
// Wrap MPI_COMM_WORLD in an Epetra communicator wrapper.
// Epetra_MpiComm is a subclass of Epetra_Comm, so you may use it
// wherever an Epetra_Comm is required.
Epetra_MpiComm comm (MPI_COMM_WORLD);
#else
// Make a "serial" (non-MPI) communicator. It doesn't actually
// "communicate," because it only has one process, whose rank is
// always 0. Epetra_SerialComm is a subclass of Epetra_Comm, so you
// may use it wherever an Epetra_Comm is required.
Epetra_SerialComm comm;
cout << "Serial" << endl;
#endif
// Epetra_Comm has methods that wrap basic MPI functionality.
// MyPID() is equivalent to MPI_Comm_rank, and NumProc() to
// MPI_Comm_size.
//
// With a "serial" communicator, the rank is always 0, and the
// number of processes is always 1.
const int myRank = comm.MyPID ();
const int numProcs = comm.NumProc ();
cout << "My PID is:" << myRank << endl;
if (myRank == 0) {
cout << "Total number of processes: " << numProcs << endl;
}
// Do something with the new Epetra communicator.
exampleRoutine (comm, cout);
// This tells the Trilinos test framework that the test passed.
if (comm.MyPID () == 0) {
cout << "End Result: TEST PASSED" << endl;
}
#ifdef HAVE_MPI
// Since you called MPI_Init, you are responsible for calling
// MPI_Finalize after you are done using MPI.
(void) MPI_Finalize ();
#endif // HAVE_MPI
return 0;
}
最佳答案
最后我发现问题出在 env -i
命令上 - 它甚至删除了 g++
路径,所以 makefile 必须在没有它的情况下启动。
关于c++ - Trilinos - C++ : error trying to exec 'cc1plus' : execvp: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27929308/
我想知道是否可以访问放在 tomcat 的 conf 文件夹中的文件。通常我会在这个文件中放置多个 webapp 的配置,在 war 之外。 我想使用类路径独立于文件系统。 我过去使用过 lib 文件
我有一个 PowerShell 脚本,它获取文件列表并移动满足特定条件的文件。为什么即使对象为空,foreach 循环也会运行? 我假设如果 $i 不存在,它就不会运行。但是如果 $filePath
我已将 BasicAccountRule.drl 放置在我的 Web 应用程序中,位置为:C:/workspace/exim_design/src/main/resources/rules/drl/i
我使用 File.open('file.txt').class 和 File.open('file.txt').readlines.class 以及前者进行了检查一个返回 File,后者返回 Arra
我正在尝试使用 FileOutputStream 删除文件,在其中写入内容后。这是我用来编写的代码: private void writeContent(File file, String fileC
我正在尝试使用 flink 和 python 批处理 api 测试 Wordcount 经典示例。我的问题是,将数据源从 env.from_elements() 修改为 env.read_text()
我正在尝试制作一个可以同时处理多个不同文件的程序。我的想法是制作一个包含 20 个 FILE* 的数组,以便在我达到此限制时能够关闭其中一个并打开请求的新文件。 为此,我想到了一个函数,它选择一个选项
我有两个文件A和B文件A: 976464 792992 文件B TimeStamp,Record1,976464,8383,ABCD 我想搜索文件 A 和文件 B 中的每条记录并打印匹配的记录。打印的
我有一些保存在 map 中的属性文件。示例: Map map = new HashMap<>(); map.put("1", "One"); map.put("2", "Two"); map.put(
我正在尝试找出一个脚本文件,该文件接受一个包含文件列表的文件(每一行都是一个文件路径,即 path/to/file)并将它们合并到一个文件中。 例如: list.text -- path/to/fil
为了使用 File.CreateText() 和 File.AppendText() 你必须: 通过调用这些方法之一打开流 写消息 关闭流 处理流 为了使用 File.AppendAllText()
使用rsync时,如何在使用--files-from参数复制时重命名文件?我有大约190,000个文件,在从源复制到目标时,每个文件都需要重命名。我计划将文件列表放在一个文本文件中传递给--files
我在非服务器应用程序中使用 Spring(只需从 Eclipse 中某个类的 main() 编译并运行它)。 我的问题是作为 new FileSystemXmlApplicationContext 的
QNX (Neutrino 6.5.0) 使用 ksh 的开源实现作为其 shell 。许多提供的脚本,包括系统启动脚本,都使用诸如 if ! test /dev/slog -ef /dev/slog
当我尝试打开从我的应用程序下载的 xls 文件时,出现此错误: excel cannot open the file because the file format or file extension
有一些相关的概念,即文件指针、流和文件描述符。 我知道文件指针是指向数据类型 FILE 的指针(在例如 FILE.h 和 struct_FILE.h 中声明)。 我知道文件描述符是 int ,例如成员
好吧,这应该很容易... 我是groovy的新手,我希望实现以下逻辑: def testFiles = findAllTestFiles(); 到目前为止,我想出了下面的代码,该代码可以成功打印所有文
我理解为什么以下内容会截断文件的内容: Get-Content | Out-File 这是因为 Out-File 首先运行,它会在 Get-Content 有机会读取文件之前清空文件。 但是当我尝
您好,我正在尝试将文件位置表示为变量,因为最终脚本将在另一台机器上运行。这是我尝试过的代码,然后是我得到的错误。在我看来,python 是如何添加“\”的,这就是导致问题的原因。如果是这种情况,我如何
我有一个只包含一行的输入文件: $ cat input foo bar 我想在我的脚本中使用这一行,据我所知有 3 种方法: line=$(cat input) line=$( input"...,
我是一名优秀的程序员,十分优秀!