0

I'm not sure what I'm doing here, I'm trying to compile code so I can run it in python. The makefile is in the file S4, when I run make it creates the folder build, and for some reason it expects the file S4.cpp inside which doesn't make any sense because it empty, here's the error I get:

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

When I place S4.cpp and S4.o inside their respective folders I still get this error:

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.

I'm running make on windows and using python 2.5.7. Here's the link to what I'm trying to compile and run in python Stanford Stratified Structure Solver its been giving me so many issues for the past 3 weeks and I need help installing it correctly.

I probably have to change my makefile, its meant to be for python and lua depending on what you prefer I'm going with python, so here's the makefile code:

# 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

If there's anything you could point out in the code to help avoid any future problems I'd be grateful.

  • There must be something else than what you show. Did you try to modify some of the Makefiles? Or are there typos in your copy of the error messages? According the error messages make is trying to compile `S4/S4.cpp` into `build/S4k/S4.cpp`, which does not make sense and has nothing to do with the Makefile you show. The Makefile you show should try to compile `S4/S4.cpp` into `build/S4k/S4.o`. – Renaud Pacalet Jul 14 '18 at 06:03
  • Your second attempt (invoking make from `S4\build\S4k`) is not supposed to work. All this is supposed to be built by invoking make from the top directory (`S4`), not from sub-directories. And if you do this anyway you should get a different error message than what you show because there is no Makefile in this directory. – Renaud Pacalet Jul 14 '18 at 06:13
  • i fixed that thanks! – Leen Almadani Jul 15 '18 at 21:06

1 Answers1

0

The problem is not related to the content of your makefile.

The problem is that you don't have the g++ program installed on your Windows system or, if you do, make cannot find it. That error means that it couldn't invoke the program you asked to be invoked in your recipe (g++ in this case).

MadScientist
  • 92,819
  • 9
  • 109
  • 136
  • now i get this error mkdir "build" ,┌-t [main] C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\sh.exe 1000 (0) sync_with_child: child 9932(0x190) died before initialization with status code 0x1 [main] sh 1000 (0) sync_with_child: *** child state waiting for longjmp Cannot fork make: *** [objdir] Error 2 – Leen Almadani Jul 15 '18 at 21:07
  • Looks like you tried to install Cygwin but it's not installed correctly or not working. You should start by googling those errors and see what you find. If you can't find anything you'll have to ask a new question about that, it can't be solved in comments. Please tag cygwin. I don't know much about Windows development and less about Cygwin so I won't be much help. – MadScientist Jul 15 '18 at 22:38