Advertisement

Can't get 'make' to work to build SOIL2 library

Started by October 05, 2019 09:26 AM
7 comments, last by Shinerd 5 years, 2 months ago

I'm new to graphics and I'm struggling to get the SOIL2 library included.

When I run the 'make' command on Mac for use by Xcode I get the following error:
 

Linking soil2-static-lib

ar: no archive members specified

...

make[1]: *** [../../lib/macosx/libsoil2-debug.a] Error 1

make: *** [soil2-static-lib] Error 2

I'm unsure how to fix this and have been going around in circles for ages! 

Any help would be appreciated

Can you tell if the makefile sets the AOBJS variable as you would expect it?

Advertisement

hmm.. I'm not sure?

This is my makefile 

 


# GNU Make solution makefile autogenerated by Premake
# Type "make help" for usage help

ifndef config
  config=debug
endif
export config

PROJECTS := soil2-static-lib soil2-shared-lib soil2-test soil2-perf-test

.PHONY: all clean help $(PROJECTS)

all: $(PROJECTS)

soil2-static-lib: 
	@echo "==== Building soil2-static-lib ($(config)) ===="
	@${MAKE} --no-print-directory -C . -f soil2-static-lib.make

soil2-shared-lib: 
	@echo "==== Building soil2-shared-lib ($(config)) ===="
	@${MAKE} --no-print-directory -C . -f soil2-shared-lib.make

soil2-test: soil2-static-lib
	@echo "==== Building soil2-test ($(config)) ===="
	@${MAKE} --no-print-directory -C . -f soil2-test.make

soil2-perf-test: soil2-static-lib
	@echo "==== Building soil2-perf-test ($(config)) ===="
	@${MAKE} --no-print-directory -C . -f soil2-perf-test.make

clean:
	@${MAKE} --no-print-directory -C . -f soil2-static-lib.make clean
	@${MAKE} --no-print-directory -C . -f soil2-shared-lib.make clean
	@${MAKE} --no-print-directory -C . -f soil2-test.make clean
	@${MAKE} --no-print-directory -C . -f soil2-perf-test.make clean

help:
	@echo "Usage: make [config=name] [target]"
	@echo ""
	@echo "CONFIGURATIONS:"
	@echo "   debug"
	@echo "   release"
	@echo ""
	@echo "TARGETS:"
	@echo "   all (default)"
	@echo "   clean"
	@echo "   soil2-static-lib"
	@echo "   soil2-shared-lib"
	@echo "   soil2-test"
	@echo "   soil2-perf-test"
	@echo ""
	@echo "For more information, see http://industriousone.com/premake/quick-start"

 

dId you solve this problem? I'm struggling to get the same thing

Right so now you need to share soil2-static-lib.make 


# GNU Make project makefile autogenerated by Premake
ifndef config
  config=debug
endif

ifndef verbose
  SILENT = @
endif

CC = gcc
CXX = g++
AR = ar

ifndef RESCOMP
  ifdef WINDRES
    RESCOMP = $(WINDRES)
  else
    RESCOMP = windres
  endif
endif

ifeq ($(config),debug)
  OBJDIR     = ../../obj/macosx/debug/soil2-static-lib
  TARGETDIR  = ../../lib/macosx
  TARGET     = $(TARGETDIR)/libsoil2-debug.a
  DEFINES   += -DDEBUG
  INCLUDES  +=
  ALL_CPPFLAGS  += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
  ALL_CFLAGS    += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -g -Wall
  ALL_CXXFLAGS  += $(CXXFLAGS) $(ALL_CFLAGS)
  ALL_RESFLAGS  += $(RESFLAGS) $(DEFINES) $(INCLUDES)
  ALL_LDFLAGS   += $(LDFLAGS)
  LDDEPS    +=
  LIBS      += $(LDDEPS)
  LINKCMD    = $(AR) -rcs $(TARGET) $(OBJECTS)
  define PREBUILDCMDS
  endef
  define PRELINKCMDS
  endef
  define POSTBUILDCMDS
  endef
endif

ifeq ($(config),release)
  OBJDIR     = ../../obj/macosx/release/soil2-static-lib
  TARGETDIR  = ../../lib/macosx
  TARGET     = $(TARGETDIR)/libsoil2.a
  DEFINES   += -DNDEBUG
  INCLUDES  +=
  ALL_CPPFLAGS  += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
  ALL_CFLAGS    += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -O2
  ALL_CXXFLAGS  += $(CXXFLAGS) $(ALL_CFLAGS)
  ALL_RESFLAGS  += $(RESFLAGS) $(DEFINES) $(INCLUDES)
  ALL_LDFLAGS   += $(LDFLAGS) -Wl,-x
  LDDEPS    +=
  LIBS      += $(LDDEPS)
  LINKCMD    = $(AR) -rcs $(TARGET) $(OBJECTS)
  define PREBUILDCMDS
  endef
  define PRELINKCMDS
  endef
  define POSTBUILDCMDS
  endef
endif

OBJECTS := \
	$(OBJDIR)/image_helper.o \
	$(OBJDIR)/image_DXT.o \
	$(OBJDIR)/SOIL2.o \
	$(OBJDIR)/etc1_utils.o \

RESOURCES := \

SHELLTYPE := msdos
ifeq (,$(ComSpec)$(COMSPEC))
  SHELLTYPE := posix
endif
ifeq (/bin,$(findstring /bin,$(SHELL)))
  SHELLTYPE := posix
endif

.PHONY: clean prebuild prelink

all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)
	@:

$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)
	@echo Linking soil2-static-lib
	$(SILENT) $(LINKCMD)
	$(POSTBUILDCMDS)

$(TARGETDIR):
	@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
	$(SILENT) mkdir -p $(TARGETDIR)
else
	$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif

$(OBJDIR):
	@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
	$(SILENT) mkdir -p $(OBJDIR)
else
	$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif

clean:
	@echo Cleaning soil2-static-lib
ifeq (posix,$(SHELLTYPE))
	$(SILENT) rm -f  $(TARGET)
	$(SILENT) rm -rf $(OBJDIR)
else
	$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
	$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif

prebuild:
	$(PREBUILDCMDS)

prelink:
	$(PRELINKCMDS)

ifneq (,$(PCH))
$(GCH): $(PCH)
	@echo $(notdir $<)
	$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
endif

$(OBJDIR)/image_helper.o: ../../src/SOIL2/image_helper.c
	@echo $(notdir $<)
	$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"

$(OBJDIR)/image_DXT.o: ../../src/SOIL2/image_DXT.c
	@echo $(notdir $<)
	$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"

$(OBJDIR)/SOIL2.o: ../../src/SOIL2/SOIL2.c
	@echo $(notdir $<)
	$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"

$(OBJDIR)/etc1_utils.o: ../../src/SOIL2/etc1_utils.c
	@echo $(notdir $<)
	$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"

-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
  -include $(OBJDIR)/$(notdir $(PCH)).d
endif

Okay, This is mine

Advertisement

Makefiles aren't much magic, unless you count all the automagic generated crap that makefile generators typically add.

There are two ways to make progress here. Either you debug what the makefile is (not) doing, or you start at a lower level and build towards a sane makefile.

To debug, disable the silence (ie delete the @ at the start of a command so it gets echoed to the output) in the makefile so you can at least see what commands it executes, and how it fails. Then figure out whether the command is wrong or your source code and data is wrong, and fix.

Starting from the ground up involves figuring out how to build the code from the command-line without any build magic. If you never did this, it feels complicated, but it's not that hard (until you want it generic, that is). Once you have that, make your own batch script or makefile which is mostly just copy/paste of the command-lines in the simple case, possibly added with some substitutions added to make it a bit more flexible and compact.

Thank you for your comment.
But I have no idea about what 'makefile' is or to 'make'.

I just... wanted to use soil2 for my first opengl/c++ application.

What I used  is premake4 to 'make' soil2.

That means, I didn't even write the makefile by myself... so is there anything to do to handle this?

This topic is closed to new replies.

Advertisement