我需要解决稀疏线性系统的能力,所以根据说明我需要安装SuperLU版本4.3。我安装了SuperLu4.3,但当试图构建犰狳时,我收到以下错误
目标犰狳的扫描依赖性
[100%]构建CXX对象cmakefiles/armadillo.dir/src/wrapper.cpp.o链接CXX共享库libarmadillo.so
制造[2]:***[libarmadillo.so.6.5005]错误1
make[1]:***[cmakefiles/armadillo.dir/all]错误2
make:***[全部]错误2
链接CXX共享库libarmadillo.so
/usr/bin/ld://usr/lib/superlu_4.3/lib/libsuperlu_4.3.a(Superlu_timer.o):在创建共享对象时,不能使用针对未定义符号`sysconf@@glibc2.2.5'的重定位R_X86_64_PC32;用-fpic重新编译
/usr/bin/ld:最终链接失败:错误值
制造[2]:***[libarmadillo.so.6.5005]错误1
make[1]:***[cmakefiles/armadillo.dir/all]错误2
make:***[全部]错误2
############################################################################
#
# Program: SuperLU
#
# Module: Makefile
#
# Purpose: Top-level Makefile
#
# Creation date: October 2, 1995
#
# Modified: February 4, 1997 Version 1.0
# November 15, 1997 Version 1.1
# September 1, 1999 Version 2.0
# October 15, 2003 Version 3.0
# August 1, 2008 Version 3.1
#
############################################################################
include make.inc
all: install lib testing
lib: superlulib tmglib
clean: cleanlib cleantesting
install:
( cd INSTALL; $(MAKE) )
# ( cd INSTALL; cp lsame.c ../SRC/; \
# cp dlamch.c ../SRC/; cp slamch.c ../SRC/ )
blaslib:
( cd CBLAS; $(MAKE) )
superlulib:
( cd SRC; $(MAKE) )
tmglib:
( cd TESTING/MATGEN; $(MAKE) )
matlabmex:
( cd MATLAB; $(MAKE) )
testing:
( cd TESTING ; $(MAKE) )
doc:
doxygen Doxyfile
cleanlib:
( cd SRC; $(MAKE) clean )
( cd TESTING/MATGEN; $(MAKE) clean )
( cd CBLAS; $(MAKE) clean )
cleantesting:
( cd INSTALL; $(MAKE) clean )
( cd TESTING; $(MAKE) clean )
( cd MATLAB; $(MAKE) clean )
( cd EXAMPLE; $(MAKE) clean )
( cd FORTRAN; $(MAKE) clean )
############################################################################
#
# Program: SuperLU
#
# Module: make.inc
#
# Purpose: Top-level Definitions
#
# Creation date: October 2, 1995
#
# Modified: February 4, 1997 Version 1.0
# November 15, 1997 Version 1.1
# September 1, 1999 Version 2.0
#
############################################################################
#
# The machine (platform) identifier to append to the library names
#
PLAT = _linux
#
# The name of the libraries to be created/linked to
#
SuperLUroot = /usr/lib/SuperLU_4.3
SUPERLULIB = $(SuperLUroot)/lib/libsuperlu_4.3.a
#BLASLIB = $(SuperLUroot)/lib/libblas.a
## ATLAS BLAS causes single-precision to fail
#BLASDEF = -DUSE_VENDOR_BLAS
#BLASLIB = /usr/lib/libopenblas.a
## This BLAS causes single-precision to fail the test in SuperLU
# BLASDEF = -DUSE_VENDOR_BLAS
BLASLIB = ../lib/blas$(PLAT).a
TMGLIB = libtmglib.a
LIBS = $(SUPERLULIB) $(BLASLIB)
#
# The archiver and the flag(s) to use when building archive (library)
# If your system has no ranlib, set RANLIB = echo.
#
ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib
CC = gcc
CFLAGS = -O3 -fPIC
NOOPTS =
FORTRAN = g77
FFLAGS = -O2 -fPIC
LOADER = $(CC)
LOADOPTS = -fPIC
#
# C preprocessor defs for compilation for the Fortran interface
# (-DNoChange, -DAdd_, -DAdd__, or -DUpCase)
#
CDEFS = -DAdd_
#
# The directory in which Matlab is installed
#
MATLAB = /usr/local/MATLAB/R2015b
# makefile for sparse supernodal LU, implemented in ANSI C
include ../make.inc
#######################################################################
# This is the makefile to create a library for SuperLU.
# The files are organized as follows:
#
# ALLAUX -- Auxiliary routines called from all precisions of SuperLU
# LAAUX -- LAPACK auxiliary routines called from all precisions
# SLASRC -- LAPACK single precision real routines
# DLASRC -- LAPACK double precision real routines
# CLASRC -- LAPACK single precision complex routines
# ZLASRC -- LAPACK double precision complex routines
# SCLAUX -- LAPACK Auxiliary routines called from both real and complex
# DZLAUX -- LAPACK Auxiliary routines called from both double precision
# and complex*16
# SLUSRC -- Single precision real SuperLU routines
# DLUSRC -- Double precision real SuperLU routines
# CLUSRC -- Single precision complex SuperLU routines
# ZLUSRC -- Double precision complex SuperLU routines
#
# The library can be set up to include routines for any combination
# of the four precisions. To create or add to the library, enter make
# followed by one or more of the precisions desired. Some examples:
# make single
# make single double
# make single double complex complex16
# Alternatively, the command
# make
# without any arguments creates a library of all four precisions.
# The library is called
# superlu.a
# and is created at the next higher directory level.
#
# To remove the object files after the library is created, enter
# make clean
#
#######################################################################
### LAPACK
LAAUX = lsame.o xerbla.o
SLASRC = slacon.o
DLASRC = dlacon.o
CLASRC = clacon.o scsum1.o icmax1.o
ZLASRC = zlacon.o dzsum1.o izmax1.o
SCLAUX = slamch.o
DZLAUX = dlamch.o
### SuperLU
ALLAUX = superlu_timer.o util.o memory.o get_perm_c.o mmd.o \
sp_coletree.o sp_preorder.o sp_ienv.o relax_snode.o \
heap_relax_snode.o colamd.o \
ilu_relax_snode.o ilu_heap_relax_snode.o mark_relax.o \
mc64ad.o qselect.o
SLUSRC = \
sgssv.o sgssvx.o \
ssp_blas2.o ssp_blas3.o sgscon.o \
slangs.o sgsequ.o slaqgs.o spivotgrowth.o \
sgsrfs.o sgstrf.o sgstrs.o scopy_to_ucol.o \
ssnode_dfs.o ssnode_bmod.o \
spanel_dfs.o spanel_bmod.o \
sreadhb.o sreadrb.o sreadtriple.o \
scolumn_dfs.o scolumn_bmod.o spivotL.o spruneL.o \
smemory.o sutil.o smyblas2.o \
sgsisx.o sgsitrf.o sldperm.o \
ilu_sdrop_row.o ilu_ssnode_dfs.o \
ilu_scolumn_dfs.o ilu_spanel_dfs.o ilu_scopy_to_ucol.o \
ilu_spivotL.o sdiagonal.o
DLUSRC = \
dgssv.o dgssvx.o \
dsp_blas2.o dsp_blas3.o dgscon.o \
dlangs.o dgsequ.o dlaqgs.o dpivotgrowth.o \
dgsrfs.o dgstrf.o dgstrs.o dcopy_to_ucol.o \
dsnode_dfs.o dsnode_bmod.o dpanel_dfs.o dpanel_bmod.o \
dreadhb.o dreadrb.o dreadtriple.o \
dcolumn_dfs.o dcolumn_bmod.o dpivotL.o dpruneL.o \
dmemory.o dutil.o dmyblas2.o \
dgsisx.o dgsitrf.o dldperm.o \
ilu_ddrop_row.o ilu_dsnode_dfs.o \
ilu_dcolumn_dfs.o ilu_dpanel_dfs.o ilu_dcopy_to_ucol.o \
ilu_dpivotL.o ddiagonal.o
## dgstrsL.o dgstrsU.o
CLUSRC = \
scomplex.o cgssv.o cgssvx.o csp_blas2.o csp_blas3.o cgscon.o \
clangs.o cgsequ.o claqgs.o cpivotgrowth.o \
cgsrfs.o cgstrf.o cgstrs.o ccopy_to_ucol.o \
csnode_dfs.o csnode_bmod.o \
cpanel_dfs.o cpanel_bmod.o \
creadhb.o creadrb.o creadtriple.o \
ccolumn_dfs.o ccolumn_bmod.o cpivotL.o cpruneL.o \
cmemory.o cutil.o cmyblas2.o \
cgsisx.o cgsitrf.o cldperm.o \
ilu_cdrop_row.o ilu_csnode_dfs.o \
ilu_ccolumn_dfs.o ilu_cpanel_dfs.o ilu_ccopy_to_ucol.o \
ilu_cpivotL.o cdiagonal.o
ZLUSRC = \
dcomplex.o zgssv.o zgssvx.o zsp_blas2.o zsp_blas3.o zgscon.o \
zlangs.o zgsequ.o zlaqgs.o zpivotgrowth.o \
zgsrfs.o zgstrf.o zgstrs.o zcopy_to_ucol.o \
zsnode_dfs.o zsnode_bmod.o \
zpanel_dfs.o zpanel_bmod.o \
zreadhb.o zreadrb.o zreadtriple.o \
zcolumn_dfs.o zcolumn_bmod.o zpivotL.o zpruneL.o \
zmemory.o zutil.o zmyblas2.o \
zgsisx.o zgsitrf.o zldperm.o \
ilu_zdrop_row.o ilu_zsnode_dfs.o \
ilu_zcolumn_dfs.o ilu_zpanel_dfs.o ilu_zcopy_to_ucol.o \
ilu_zpivotL.o zdiagonal.o
all: single double complex complex16
single: $(SLUSRC) $(ALLAUX) $(LAAUX) $(SLASRC) $(SCLAUX)
$(ARCH) $(ARCHFLAGS) $(SUPERLULIB) \
$(SLUSRC) $(ALLAUX) $(LAAUX) $(SLASRC) $(SCLAUX)
$(RANLIB) $(SUPERLULIB)
double: $(DLUSRC) $(ALLAUX) $(LAAUX) $(DLASRC) $(DZLAUX)
$(ARCH) $(ARCHFLAGS) $(SUPERLULIB) \
$(DLUSRC) $(ALLAUX) $(LAAUX) $(DLASRC) $(DZLAUX)
$(RANLIB) $(SUPERLULIB)
complex: $(CLUSRC) $(ALLAUX) $(LAAUX) $(CLASRC) $(SCLAUX)
$(ARCH) $(ARCHFLAGS) $(SUPERLULIB) \
$(CLUSRC) $(ALLAUX) $(LAAUX) $(CLASRC) $(SCLAUX)
$(RANLIB) $(SUPERLULIB)
complex16: $(ZLUSRC) $(ALLAUX) $(LAAUX) $(ZLASRC) $(DZLAUX)
$(ARCH) $(ARCHFLAGS) $(SUPERLULIB) \
$(ZLUSRC) $(ALLAUX) $(LAAUX) $(ZLASRC) $(DZLAUX)
$(RANLIB) $(SUPERLULIB)
##################################
# Do not optimize these routines #
##################################
slamch.o: slamch.c ; $(CC) -c $(NOOPTS) $(CDEFS) $<
dlamch.o: dlamch.c ; $(CC) -c $(NOOPTS) $(CDEFS) $<
superlu_timer.o: superlu_timer.c ; $(CC) -c $(NOOPTS) $<
##################################
.c.o:
$(CC) $(CFLAGS) $(CDEFS) $(BLASDEF) -c $< $(VERBOSE)
.f.o:
$(FORTRAN) $(FFLAGS) -c $<
clean:
rm -f *.o $(SUPERLULIB)
用CMake生成犰狳Makefile
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = /usr/bin/cmake-gui
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/daniel/Downloads/armadillo-6.500.5
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/daniel/Downloads/armadillo-6.500.5
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/bin/cmake-gui -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\" \"dev\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/daniel/Downloads/armadillo-6.500.5/CMakeFiles /home/daniel/Downloads/armadillo-6.500.5/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/daniel/Downloads/armadillo-6.500.5/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named armadillo
# Build rule for target.
armadillo: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 armadillo
.PHONY : armadillo
# fast build rule for target.
armadillo/fast:
$(MAKE) -f CMakeFiles/armadillo.dir/build.make CMakeFiles/armadillo.dir/build
.PHONY : armadillo/fast
# Manual pre-install relink rule for target.
armadillo/preinstall:
$(MAKE) -f CMakeFiles/armadillo.dir/build.make CMakeFiles/armadillo.dir/preinstall
.PHONY : armadillo/preinstall
src/wrapper.o: src/wrapper.cpp.o
.PHONY : src/wrapper.o
# target to build an html" target="_blank">object file
src/wrapper.cpp.o:
$(MAKE) -f CMakeFiles/armadillo.dir/build.make CMakeFiles/armadillo.dir/src/wrapper.cpp.o
.PHONY : src/wrapper.cpp.o
src/wrapper.i: src/wrapper.cpp.i
.PHONY : src/wrapper.i
# target to preprocess a source file
src/wrapper.cpp.i:
$(MAKE) -f CMakeFiles/armadillo.dir/build.make CMakeFiles/armadillo.dir/src/wrapper.cpp.i
.PHONY : src/wrapper.cpp.i
src/wrapper.s: src/wrapper.cpp.s
.PHONY : src/wrapper.s
# target to generate assembly for a file
src/wrapper.cpp.s:
$(MAKE) -f CMakeFiles/armadillo.dir/build.make CMakeFiles/armadillo.dir/src/wrapper.cpp.s
.PHONY : src/wrapper.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... armadillo"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... list_install_components"
@echo "... rebuild_cache"
@echo "... src/wrapper.o"
@echo "... src/wrapper.i"
@echo "... src/wrapper.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
请让我知道我应该尝试什么。我不是很有经验的编译/链接库在Linux上,所以请提供细节,如果可能的话。谢谢你。
也有同样的问题,即使在CFLAGS中设置superlu_timer.c也没有用-fpic编译
出于某种原因,SuperLU背后的人不想优化该文件,所以他们在SRC文件夹的Makefile中为这个文件设置了一个特定的目标
您可以在superlu_4.3/src/makefile中看到它:
##################################
# Do not optimize these routines #
##################################
slamch.o: slamch.c ; $(CC) -c $(NOOPTS) $(CDEFS) $<
dlamch.o: dlamch.c ; $(CC) -c $(NOOPTS) $(CDEFS) $<
superlu_timer.o: superlu_timer.c ; $(CC) -c $(NOOPTS) $<
##################################
superlu_timer.o: superlu_timer.c ; $(CC) -fPIC -c $(NOOPTS) $<
我正在制作一个需要libgmp的共享库。我的目标是将静态libgmp嵌入到共享库中。 我尝试过。/configure with cflags=“-fpic”。此外,我还尝试修改了libgmp源代码的subdir中的所有Makefile,以便用-fpic编译所有代码。(脏活累活) 但是,当我将libgmp.a链接到共享库时,仍然收到错误消息。 /usr/bin/ld://usr/local/lib/
问题内容: 我可以使用带有静态链接的gcc构建可执行文件: gcc-静态xxx.c -o xxx 所以我可以在没有任何外部依赖库的情况下运行xxx。 但是,如果我要构建没有外部依赖库的共享库怎么办?我的意思是我希望共享库静态链接其外部引用。 问题答案: 这将起作用: 需要说明的是:-static标志(如果提供给gcc)会传递给链接器(ld),并告诉它与库的静态版本(.a)(由-l标志指定)一起使用
我试图安装一个库,但运行make后出现以下错误。如何用标志重新编译? 使目标pwrutils的扫描依赖项链接CXX共享库libpwrutils.so/usr/bin/ld://usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../../x86_64-linux-gnu/libboost_system.a(error_code.o):在创建共享对象时不能使用针对`
15.3.5.构建共享库 假定你已经安装好了NDK,解下来就可以构建共享库了:切换到项目目录,执行ndk/ndk-build即可。其中ndk表示你的NDK安装目录。 构建完成之后,你可以见到一个新的子目录lib,里面放有刚刚生成的共享库文件。 Note: 共享库默认是面向ARM平台构建,这样可以方便在仿真器上运行。 在下一节,我们将共享库打包进APK文件,供应用程序调用。
问题内容: 假设我有一个与field共享的对象。多个线程将共享对该对象的引用以访问该字段。但是,线程永远不会同时访问对象。我需要声明为volatile吗? 这样的情况如下: 一个类定义一个唯一字段和一个方法。 一个线程使计数器递增,然后生成另一个使计数器递增的线程,依此类推。 鉴于程序的逻辑,因此无法并发访问计数器。但是,计数器是在多个线程之间共享的。计数器必须波动吗? 的情况的另一个变体是当多个
我已经编写了一个库,过去我使用自编的Makefile编译它,但现在我想切换到cmake。树是这样的(我删除了所有不相关的文件): 我只是想把它编译到一个共享的文件库中。 我发现的大多数示例都使用一些共享库编译可执行文件,但绝不仅仅是一个普通的共享库。如果有人能告诉我一个使用cmake的非常简单的库,那也会很有帮助,所以我可以用这个作为例子。