Search code examples
c++makefilecygwin

cygwin make error: Specified module could not be found


I was mostly used to dll and lib extensions when using third-party libraries which I used to comfortably incorporate using Visual Studio in my Windows Environment.

But this time, I'm trying to use PicklingTools which has a MakeFile.Linux file which I've been trying to build using make from cygwin.

The version of make is 4.3 while for g++ it is 9.2.0.

Here's the entire MakeFile.Linux source code:

CC = g++
# CC = icc     # Intel seems to work

## With g++ --version==4.4.x, you may need -fno-strict-aliasing to get rid 
## of some annoying warnings when you compile with -O2 or above

# *****CAREFUL! g++ 4.5.1 20100924 DOES NOT WORK with Ptools and -O.  You must
# compile without optimization for that compiler to work

OC = ./opencontainers_1_8_5
OCINC = $(OC)/include

CFLAGS = -Wall -Wextra -fpic -O -fno-strict-aliasing -DLINUX_ -DOC_NEW_STYLE_INCLUDES -Wno-deprecated -I$(OCINC) -pthread -D_REENTRANT

## How to build with OCString
##CFLAGS = -Wall -O4 -DLINUX_ -DOC_USE_OC_STRING -DOC_USE_OC_EXCEPTIONS -DOC_ONLY_NEEDED_STL -DOC_NEW_STYLE_INCLUDES -Wno-deprecated -I$(OCINC) 

###### CFLAGS = -Wall -O4 -DLINUX_-DOC_NEW_STYLE_INCLUDES -Wno-deprecated -I$(OCINC) 


CCFLAGS = -pthread $(CFLAGS)

COM_OBJS = m2pythontools.o valpython.o midassocket.o valprotocol2.o m2ser.o m2streamdataenc.o m2convertrep.o timeconv.o fdtools.o
OBJS = midastalker_ex.o midastalker_ex2.o httpclient_ex.o httpserver_ex.o $(COM_OBJS) load.o save.o sharedmemory.o 

all: midasyeller_ex midastalker_ex midastalker_ex2 httpclient_ex midasserver_ex permutation_server permutation_client load save opal2dict dict2opal opaltest midasyeller_ex midaslistener_ex p2_test valgetopt_ex sharedmem_test ready_test xmlload_test xmlload_ex xmldump_test xmldump_ex speed_test pickleloader_test chooseser_test xml2dict dict2xml serverside_ex clientside_ex middleside_ex

.cc.o:
    $(CC) $(CFLAGS) -c $<

libptools.so : $(COM_OBJS) 
    $(CC) $(CCFLAGS) $(COM_OBJS) -shared -o libptools.so

midasserver_ex : $(COM_OBJS) midasserver_ex.o
    $(CC) $(CCFLAGS) $(COM_OBJS) midasserver_ex.o -pthread -o midasserver_ex

httpclient_ex : $(COM_OBJS) httpclient_ex.o
    $(CC) $(CCFLAGS) $(COM_OBJS) httpclient_ex.o -pthread -o httpclient_ex

httpserver_ex : $(COM_OBJS) httpserver_ex.o
    $(CC) $(CCFLAGS) $(COM_OBJS) httpserver_ex.o -pthread -o httpserver_ex

midasyeller_ex : $(COM_OBJS) midasyeller_ex.o
    $(CC) $(CCFLAGS) $(COM_OBJS) midasyeller_ex.o -pthread -o midasyeller_ex

midaslistener_ex : $(COM_OBJS) midaslistener_ex.o
    $(CC) $(CCFLAGS) $(COM_OBJS) midaslistener_ex.o -pthread -o midaslistener_ex

permutation_server : $(COM_OBJS) permutation_server.o
    $(CC) $(CCFLAGS) $(COM_OBJS) permutation_server.o -pthread -o permutation_server

permutation_client : $(COM_OBJS) permutation_client.o
    $(CC) $(CCFLAGS) $(COM_OBJS) permutation_client.o -pthread -o permutation_client

midastalker_ex :$(COM_OBJS) midastalker_ex.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) midastalker_ex.o -o midastalker_ex

midastalker_ex2 :$(COM_OBJS) midastalker_ex2.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) midastalker_ex2.o -o midastalker_ex2

load : $(COM_OBJS) load.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) load.o -o load

serverside_ex : $(COM_OBJS) sharedmem.o shmboot.o serverside_ex.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) sharedmem.o shmboot.o -lrt serverside_ex.o -o serverside_ex 

middleside_ex : $(COM_OBJS) middleside_ex.o sharedmem.o shmboot.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) sharedmem.o shmboot.o -l rt middleside_ex.o -o middleside_ex 

clientside_ex : $(COM_OBJS) clientside_ex.o sharedmem.o shmboot.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) sharedmem.o shmboot.o -lrt clientside_ex.o -o clientside_ex 

samplehttpserver_ex : $(COM_OBJS) samplehttpserver_ex.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) samplehttpserver_ex.o -o samplehttpserver_ex

save : $(COM_OBJS) save.o
    $(CC) $(CCFLAGS) $(COM_OBJS) save.o -o save

opal2dict : $(COM_OBJS) opal2dict.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) opal2dict.o -o opal2dict

opaltest : $(COM_OBJS) opaltest.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) opaltest.o -o opaltest

ready_test : $(COM_OBJS) ready_test.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) ready_test.o -o ready_test

chooseser_test : $(COM_OBJS) chooseser_test.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) chooseser_test.o -o chooseser_test

dict2opal : $(COM_OBJS) dict2opal.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) dict2opal.o -o dict2opal

pickleloader_test :  $(COM_OBJS) pickleloader_test.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) pickleloader_test.o -o pickleloader_test -lrt

xmldump_test :  $(COM_OBJS) xmldump_test.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) xmldump_test.o -o xmldump_test -lrt

xmldump_ex :  $(COM_OBJS) xmldump_ex.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) xmldump_ex.o -o xmldump_ex -lrt

xmlload_test :  $(COM_OBJS) xmlload_test.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) xmlload_test.o -o xmlload_test -lrt

xmlload_ex :  $(COM_OBJS) xmlload_ex.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) xmlload_ex.o -o xmlload_ex -lrt

xml2dict :  $(COM_OBJS) xml2dict.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) xml2dict.o -o xml2dict -lrt

dict2xml :  $(COM_OBJS) dict2xml.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) dict2xml.o -o dict2xml -lrt
 
speed_test :  $(COM_OBJS) speed_test.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) speed_test.o -o speed_test -lrt

p2_test :  $(COM_OBJS) p2_test.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) p2_test.o -o p2_test -lrt

valgetopt_ex :  $(COM_OBJS) valgetopt_ex.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) valgetopt_ex.o -o valgetopt_ex

json_ex :  $(COM_OBJS) json_ex.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) json_ex.o -o json_ex

# Only the tests that REALLY uses UNIX shared memory need the -lrt
sharedmem_test :  $(COM_OBJS) sharedmem_test.o sharedmem.o
    $(CC) $(CCFLAGS) $(COM_OBJS) sharedmem.o -lrt sharedmem_test.o -o sharedmem_test


# Only the tests that REALLY uses UNIX shared memory need the -lrt
checkshm_test :  $(COM_OBJS) checkshm_test.o sharedmem.o
    $(CC) $(CCFLAGS) $(COM_OBJS) sharedmem.o -lrt checkshm_test.o -o checkshm_test


clean :
    /bin/rm -rf *.o *.so *~ midastalker_ex midastalker_ex2 httpserver_ex httpclient_ex midasserver_ex midasyeller_ex midaslistener_ex permutation_server permutation_client load save cxx_repository opal2dict opaltest dict2opal p2_test valgetopt_ex json_ex sharedmem_test ready_test speed_test pickleloader_test chooseser_test xmldump_test xmldump_ex xmlload_test xmlload_ex xml2dict dict2xml samplehttpserver_ex serverside_ex clientside_ex middleside_ex checkshm_test

Upon building it (after moving to that directory) using make -f MakeFile.Linux all I get the following error:

Makefile.Linux:61: The specified module could not be found.
Makefile.Linux:61: *** :: failed to load.  Stop.

Line number 60-63 is:


load : $(COM_OBJS) load.o 
    $(CC) $(CCFLAGS) $(COM_OBJS) load.o -o load

And here are the files that are available for C++ directory: directory screenshot

BUILDING textfile mentions that it uses some socket unix libraries which my cygwin environment maybe missing but I can't figure out the exact source of error, here are some relevant lines from BUILDING:

C++:    This C++ subdirectory is all raw C++ code.  There are no
        external dependencies (besides standard UNIX socket code) or libraries
        the C++ area needs.

        The Makefile.Linux gives examples how to build some code:
          
          % make -f Makefile.Linux all

        ... will build a bunch of sample programs as well 'libptools.so',
        a standalone library for PicklingTools you can link against.
         
        Probably the easist way to use Ptools in your own code is 
        to compile the libptools.so (using the given Makefile) 
        and link against it.

           % Make -f Makefile.Linux libptools.so
 
        In your own code, make sure you include the following flags to the
        compiler (should work for Intel compiler and GNU compiler):

            -fno-strict-aliasing -DLINUX_ -DOC_NEW_STYLE_INCLUDES -Wno-deprecated -I/home/me/PicklingTools160/C++/opencontainers_1_8_2/include -I/home/me/PicklingTools160/C++ -pthread -D_REENTRANT

I've tried looking around SO but couldn't find anything similar that could help.


Solution

  • Unfortunately in newer versions of make, load is a special word and make fails when load is used as a target. This is quite bad, actually, as it violates POSIX etc. There's a Savannah bug open about this. You can work around the issue by using a variable instead:

    load = load
    
    $(load) : $(COM_OBJS) load.o 
            $(CC) $(CCFLAGS) $(COM_OBJS) load.o -o load