问题描述
当尝试在Mac OS X 10.8上使用make make
构建FreeImage 3.1.5.4时出现以下错误 g ++ - 4.0:没有此类文件或目录
。关于编译器配置的makefile有问题。如何解决这个问题?
When trying to build FreeImage 3.1.5.4 on Mac OS X 10.8 with make make
the following error g++-4.0: No such file or directory
occurs. There is something wrong with the makefile regarding the compiler configuration. How to fix this?
推荐答案
FreeImage 3.1.5.4的 makefile.osx
OS X版本> 10.6。看到这篇文章的底部的修改版本。除了解决中描述的问题,您需要向 Source / OpenEXR / IlmImf / ImfAutoArray.h :
The makefile.osx
of FreeImage 3.1.5.4 is outdated for OS X versions > 10.6. See the bottom of this post for a modified version. In addition to address the issue described at FreeImage issue tracker you need to add a line to Source/OpenEXR/IlmImf/ImfAutoArray.h
:
#include <cstring>
OS X 10.8的Makefile:
Makefile for OS X 10.8:
# -*- Makefile -*-
# Mac OSX makefile for FreeImage
# This file can be generated by ./gensrclist.sh
include Makefile.srcs
# General configuration variables:
CC_X86_64 = gcc -4.2
CPP_X86_64 = g++ -4.2
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS
COMPILERFLAGS_X86_64 = -arch x86_64
COMPILERPPFLAGS = -Wno-ctor-dtor-privacy
INCLUDE +=
INCLUDE_X86_64 = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
CFLAGS_X86_64 = $(COMPILERFLAGS) $(COMPILERFLAGS_X86_64) $(INCLUDE) $(INCLUDE_X86_64)
CPPFLAGS_X86_64 = $(COMPILERPPFLAGS) $(CFLAGS_X86_64)
LIBRARIES_X86_64 = -Wl,-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
LIBTOOL = libtool
LIPO = lipo
TARGET = freeimage
STATICLIB = lib$(TARGET).a
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib
LIBNAME = lib$(TARGET).$(VER_MAJOR).dylib
HEADER = Source/FreeImage.h
.SUFFIXES: .o-x86_64
MODULES_X86_64 = $(SRCS:.c=.o-x86_64)
MODULES_X86_64 := $(MODULES_X86_64:.cpp=.o-x86_64)
PREFIX = /usr/local
INSTALLDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include
default: all
all: dist
dist: FreeImage
cp *.a Dist
cp *.dylib Dist
cp Source/FreeImage.h Dist
FreeImage: $(STATICLIB) $(SHAREDLIB)
$(STATICLIB): $(STATICLIB)-x86_64
$(LIPO) -create $(STATICLIB)-x86_64 -output $(STATICLIB)
$(STATICLIB)-x86_64: $(MODULES_X86_64)
$(LIBTOOL) -arch_only x86_64 -o $@ $(MODULES_X86_64)
$(SHAREDLIB): $(SHAREDLIB)-x86_64
$(LIPO) -create $(SHAREDLIB)-x86_64 -output $(SHAREDLIB)
$(SHAREDLIB)-x86_64: $(MODULES_X86_64)
$(CPP_X86_64) -arch x86_64 -dynamiclib $(LIBRARIES_X86_64) -o $@ $(MODULES_X86_64)
.c.o-x86_64:
$(CC_X86_64) $(CFLAGS_X86_64) -c $< -o $@
.cpp.o-x86_64:
$(CPP_X86_64) $(CPPFLAGS_X86_64) -c $< -o $@
install:
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
clean:
rm -f core Dist/*.* u2dtmp* $(MODULES_X86_64) $(STATICLIB) $(SHAREDLIB) $(SHAREDLIB)-x86_64
这篇关于如何在Mac OS X 10.8上编译FreeImage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!