我不确定我在这里做什么,我正在尝试编译代码,以便可以在 python 中运行它。makefile 在文件 S4 中,当我运行make时,它会创建文件夹构建,并且由于某种原因它期望文件 S4.cpp 里面没有任何意义,因为它是空的,这是我得到的错误:
C:\Users\lovel\Anaconda3\S4>make
mkdir "build/S4k"
mkdir "build/modules"
g++ -c -O2 -Wall -march=native -fcx-limited-range -fno-exceptions -static - IS4 -IS4/RNP -IS4/kiss_fft S4/S4.cpp -o build/S4k/S4.cpp
process_begin: CreateProcess(NULL, g++ -c -O2 -Wall -march=native -fcx- limited-range -fno-exceptions -static -IS4 -IS4/RNP -IS4/kiss_fft S4/S4.cpp - o build/S4k/S4.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [build/S4k/S4.cpp] Error 2
当我将 S4.cpp 和 S4.o 放在它们各自的文件夹中时,我仍然收到此错误:
C:\Users\lovel\Anaconda3\S4\build\S4k>make
mkdir "build"
mkdir "build/S4k"
mkdir "build/modules"
make: *** No rule to make target `S4/S4.cpp', needed by `build/S4k/S4.o'. Stop.
我在 Windows 上运行make并使用 python 2.5.7。这是我试图在 python Stanford Stratified Structure Solver中编译和运行的链接,它在过去 3 周给我带来了很多问题,我需要帮助正确安装它。
我可能必须更改我的makefile,它适用于python 和lua,这取决于你喜欢我使用python 的方式,所以这里是makefile 代码:
# The following must be defined already:
# CC
# CXX
# OPTFLAGS
# LUA_INC
# LUA_LIB
# LUA_MODULE_LIB
# LA_LIBS
# OBJDIR
# SHLIB_EXT (so, dll)
# SHLIB_FLAGS
CPPFLAGS += -IS4 -IS4/RNP -IS4/kiss_fft
#### Compilation targets
S4_LIBNAME = libS4.a
all: $(OBJDIR)/$(S4_LIBNAME) $(OBJDIR)/S4 modules
S4mpi: $(OBJDIR)/S4mpi
objdir:
mkdir "$(OBJDIR)"
mkdir "$(OBJDIR)/S4k"
mkdir "$(OBJDIR)/modules"
S4_LIBOBJS = \
$(OBJDIR)/S4k/S4.o \
$(OBJDIR)/S4k/rcwa.o \
$(OBJDIR)/S4k/fmm_common.o \
$(OBJDIR)/S4k/fmm_FFT.o \
$(OBJDIR)/S4k/fmm_kottke.o \
$(OBJDIR)/S4k/fmm_closed.o \
$(OBJDIR)/S4k/fmm_PolBasisNV.o \
$(OBJDIR)/S4k/fmm_PolBasisVL.o \
$(OBJDIR)/S4k/fmm_PolBasisJones.o \
$(OBJDIR)/S4k/fmm_experimental.o \
$(OBJDIR)/S4k/fft_iface.o \
$(OBJDIR)/S4k/pattern.o \
$(OBJDIR)/S4k/intersection.o \
$(OBJDIR)/S4k/predicates.o \
$(OBJDIR)/S4k/numalloc.o \
$(OBJDIR)/S4k/gsel.o \
$(OBJDIR)/S4k/sort.o \
$(OBJDIR)/S4k/kiss_fft.o \
$(OBJDIR)/S4k/kiss_fftnd.o \
$(OBJDIR)/S4k/SpectrumSampler.o \
$(OBJDIR)/S4k/cubature.o \
$(OBJDIR)/S4k/Interpolator.o \
$(OBJDIR)/S4k/convert.o
ifndef LAPACK_LIB
S4_LIBOBJS += $(OBJDIR)/S4k/Eigensystems.o
endif
$(OBJDIR)/libS4.a: objdir $(S4_LIBOBJS)
$(AR) crvs $@ $(S4_LIBOBJS)
$(OBJDIR)/S4k/S4.o: S4/S4.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/rcwa.o: S4/rcwa.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_common.o: S4/fmm/fmm_common.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_FFT.o: S4/fmm/fmm_FFT.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_kottke.o: S4/fmm/fmm_kottke.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_closed.o: S4/fmm/fmm_closed.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_PolBasisNV.o: S4/fmm/fmm_PolBasisNV.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_PolBasisVL.o: S4/fmm/fmm_PolBasisVL.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_PolBasisJones.o: S4/fmm/fmm_PolBasisJones.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fmm_experimental.o: S4/fmm/fmm_experimental.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/fft_iface.o: S4/fmm/fft_iface.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/pattern.o: S4/pattern/pattern.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/intersection.o: S4/pattern/intersection.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/predicates.o: S4/pattern/predicates.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/numalloc.o: S4/numalloc.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/gsel.o: S4/gsel.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/sort.o: S4/sort.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/kiss_fft.o: S4/kiss_fft/kiss_fft.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/kiss_fftnd.o: S4/kiss_fft/tools/kiss_fftnd.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/SpectrumSampler.o: S4/SpectrumSampler.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/cubature.o: S4/cubature.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/Interpolator.o: S4/Interpolator.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/convert.o: S4/convert.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(OBJDIR)/S4k/Eigensystems.o: S4/RNP/Eigensystems.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
#### Lua Frontend
$(OBJDIR)/S4k/main_lua.o: S4/main_lua.c objdir
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(LUA_INC) $< -o $@
$(OBJDIR)/S4: $(OBJDIR)/S4k/main_lua.o $(OBJDIR)/$(S4_LIBNAME)
$(CXX) $(CFLAGS) $(CPPFLAGS) $< -o $@ -L$(OBJDIR) -lS4 $(LA_LIBS)
$(LUA_LIB)
$(OBJDIR)/S4k/main_lua_mpi.o: S4/main_lua.c objdir
$(CC) -c -DHAVE_MPI $(CFLAGS) $(CPPFLAGS) $(LUA_INC) $(MPI_INC) $< -o $@
$(OBJDIR)/S4mpi: $(OBJDIR)/S4k/main_lua_mpi.o $(OBJDIR)/$(S4_LIBNAME)
$(CXX) $(CFLAGS) $(CPPFLAGS) $< -o $@ -L$(OBJDIR) -lS4 $(LA_LIBS)
$(LUA_LIB) $(MPI_LIB)
modules: \
$(OBJDIR)/RCWA.$(SHLIB_EXT) \
$(OBJDIR)/FunctionSampler1D.$(SHLIB_EXT) \
$(OBJDIR)/FunctionSampler2D.$(SHLIB_EXT)
$(OBJDIR)/RCWA.$(SHLIB_EXT):
$(CC) $(LUA_INC) -O3 $(SHLIB_FLAGS) -fpic S4/main_lua.c -o $@$(LUA_MODULE_LIB) -L$(OBJDIR) -lS4 $(LA_LIBS) -lstdc++
$(OBJDIR)/FunctionSampler1D.$(SHLIB_EXT): modules/function_sampler_1d.c modules/function_sampler_1d.h modules/lua_function_sampler_1d.c
$(CC) -c $(OPTFLAGS) -fpic -Wall -I. modules/function_sampler_1d.c -o
$(OBJDIR)/modules/function_sampler_1d.o
$(CC) $(OPTFLAGS) $(SHLIB_FLAGS) -fpic -Wall $(LUA_INC) -o $@
$(OBJDIR)/modules/function_sampler_1d.o modules/lua_function_sampler_1d.c $(LUA_MODULE_LIB) $(OBJDIR)/FunctionSampler2D.$(SHLIB_EXT): modules/function_sampler_2d.c modules/function_sampler_2d.h modules/lua_function_sampler_2d.c
$(CC) -c $(OPTFLAGS) -fpic -Wall -I. modules/function_sampler_2d.c -o
$(OBJDIR)/modules/function_sampler_2d.o
$(CC) -c -O2 -fpic -Wall -I. modules/predicates.c -o
$(OBJDIR)/modules/mod_predicates.o
$(CC) $(OPTFLAGS) $(SHLIB_FLAGS) -fpic -Wall $(LUA_INC) -o $@
$(OBJDIR)/modules/function_sampler_2d.o
$(OBJDIR)/modules/mod_predicates.o modules/lua_function_sampler_2d.c $(LUA_MODULE_LIB)
#### Python extension
S4_pyext: objdir $(OBJDIR)/libS4.a
echo "$(LIBS)" > $(OBJDIR)/tmp.txt
sh gensetup.py.sh $(OBJDIR) $(OBJDIR)/$(S4_LIBNAME)
python setup.py build
clean:
rm -rf $(OBJDIR)
#### S4v2 extension
$(OBJDIR)/S4v2.$(SHLIB_EXT): $(OBJDIR)/$(S4_LIBNAME) S4/ext_lua.c
$(CC) $(SHLIB_FLAGS) $(LUA_INC) S4/ext_lua.c -o $@ $(LUA_MODULE_LIB) -L$(OBJDIR) -lS4 $(LA_LIBS) -lstdc++
$(OBJDIR)/libS4_lua.a: $(OBJDIR)/$(S4_LIBNAME)
$(CC) -c $(LUA_INC) S4/ext_lua.c -o $(OBJDIR)/ext_lua.o
$(AR) crvs $@ $(OBJDIR)/ext_lua.o
如果您可以在代码中指出任何内容以帮助避免将来出现任何问题,我将不胜感激。