Creating shared library fails in Git Bash shell using Makefile

BND

I am trying to create shared library i.e. .so from C++ code using Git Bash shell in Windows 10. I use Makefile for compiling C++ code in Windows 10. Running make through Git bash shell. Code compiles without any issue and creates object files without fail. But it fails while creating .so file throwing following error. Following is part of Makefile in which target VLIB_SHARED_LIBRARY is causing this error.

VLIB_SO_DIR = .
VLIB_SHARED_LIBRARY = $(VLIB_SO_DIR)/libvxxx.so
CXX = g++

CXXFLAGS = -Wall -std=c++11 -O2 -D_7ZIP_ST -fPIC
LDFLAGS = -shared

OBJECT_FILES = a.o b.o c.o d.o .. z.o

all: init $(VLIB_SHARED_LIBRARY )

release: init $(VLIB_SHARED_LIBRARY )

$(VLIB_SHARED_LIBRARY): $(OBJECT_FILES) \n
        $(CXX) $(LDFLAGS) -o $(VLIB_SHARED_LIBRARY) $(OBJECT_DIR)/*.o

process_begin: CreateProcess(C:\Program, C:/Program Files/Git/usr/bin/sh.exe -c "g++ -shared -o C:/XXXX_YYYY/bbbb/bin_linux/libyyyy.so C:/XXXX_YYYY/bbbb/bin_linux/obj/*.o", ...) failed.
make (e=193): Error 193

Same Makefile works fine in actual Linux Ubuntu OS but fails in Windows 10. How to fix this error ?

MadScientist

The reason I suggested whitespace issues in my comment above is that the error message CLEARLY shows that it's a whitespace problem:

CreateProcess(C:\Program, C:/Program Files/Git/usr/bin/sh.exe ...

There is a space in this path to sh.exe, and the first argument printed here C:\Program quite clearly shows that the path has been truncated at the space.

I thought maybe your makefile was setting SHELL to some value but it doesn't appear to be. All I can suggest is either (a) remove C:\Program Files\Git\usr\bin from your %Path%, or (b) re-install Git into a path that doesn't contain whitespace so that you don't hit this problem.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related