블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
  • total
  • today
  • yesterday

Category

2009. 7. 8. 21:56 Computer Vision
0. Freeimage 설치 실패
http://freeimage.sourceforge.net/ 에서
FreeImage3.12.0 을 다운로드하여 풀어 보니 FreeImage라는 이름의 폴더가 생성된다.
(.frameworks가 아니라서 당황하였으나, FreeImage가 library라 하였기에 frameworks라고 굳게 믿어 버렸고 경험도 있다고 자부하며, Xcode에서  프로젝트를 만들어  C++로 코딩할 때 어떻게 삽입해야 하는지를 놓고 엉뚱한 정보의 홍수에서 허우적대다가...)

다시 겸허한 마음으로
README.osx 파일을 TextEdit으로 열고, 다음 설명에 따라
Building the Library
--------------------
Makefile detects the environment by calling 'uname'. Assuming this reports 'Darwin' on your system, Makefile will automatically
defer commands to Makefile.osx. If this doesn't work, type 'make -f Makefile.osx' in place of just 'make'

The build process is as simple as this:
1) Enter the FreeImage directory
2) Build the distribution:
make
3) The libraries and header will be in the Dist directory when the build is finished

To install FreeImage in the /usr/local/lib and /usr/local/include directories (not recommended):
make install

To clean all files produced during the build process:
make clean


Additional notes
----------------

Building on Mac OS X Leopard :

Install the xcode dev tools from the Leopard disk.
When installing the dev tools make sure to have installed 10.3.9 SDK (it's not selected by default).

Terminal에서 freeimage 폴더로 들어가서 make 명령을 치면 다음과 같이 무수한 에러가 나온다.

ga07087:freeimage lym$ make
make -f Makefile.osx
g++-4.0 -Wno-ctor-dtor-privacy -Os -fexceptions -fvisibility=hidden -arch ppc -I. -ISource -ISource/Metadata -ISource/FreeImageToolkit -ISource/LibJPEG -ISource/LibMNG -ISource/LibPNG -ISource/LibTIFF -ISource/ZLib -ISource/LibOpenJPEG -ISource/OpenEXR -ISource/OpenEXR/Half -ISource/OpenEXR/Iex -ISource/OpenEXR/IlmImf -ISource/OpenEXR/IlmThread -ISource/OpenEXR/Imath  -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -c Source/FreeImage/BitmapAccess.cpp -o Source/FreeImage/BitmapAccess.o-ppc
Source/FreeImage/BitmapAccess.cpp:30:20: error: stdlib.h: No such file or directory
In file included from Source/FreeImage/BitmapAccess.cpp:35:
Source/FreeImage.h:55:51: error: wchar.h: No such file or directory
Source/FreeImage.h:152:22: error: inttypes.h: No such file or directory
In file included from Source/FreeImage/BitmapAccess.cpp:37:
Source/Utilities.h:31:18: error: math.h: No such file or directory
Source/Utilities.h:33:20: error: memory.h: No such file or directory
Source/Utilities.h:34:19: error: stdio.h: No such file or directory
Source/Utilities.h:35:20: error: string.h: No such file or directory
Source/Utilities.h:36:20: error: stdarg.h: No such file or directory
Source/Utilities.h:37:19: error: ctype.h: No such file or directory
Source/Utilities.h:38:20: error: assert.h: No such file or directory
Source/Utilities.h:40:18: error: string: No such file or directory

...(중략)


여기서 첫번째 에러 "error: stdlib.h: No such file or directory"는 Kernel error라고 하여 Linux 등의 kernel에서 바로 standard library에 접근할 수 없어 나타난다고 한다. (이를 해결하기 위한 Linux 사용자들의 "sudo apt-get install 어쩌구"와 같은 명령어도 통하지 않고 있다.)

등등등 사흘 간의 초삽질 끝에...
source codes을 mac에서 직접 compile하는 것은 내 능력으로 어렵다고 보고, MacPorts라는 것을 이용해 보기로 한다.


1. Macports 설치 성공
MacPorts (구 Darwin Ports)의 공식사이트: http://www.macports.org
MacPorts는 Apple 사가 진행하는 OpenDarwin 프로젝트의 일부이며, 오픈 소스 소프트웨어의 컴파일, 설치, 업그레이드를 쉽게 할 수 있게 해 주는 오픈 소스 '패키지 관리 시스템'이라고 하는데 자세히는 모르겠다. (참고: http://en.wikipedia.org/wiki/Macports)

(Mac 용 Freeimage가 frameworks 형식으로 제공되는 것이 아니라서 내게 생소했던 것이다. 그냥 소스코드와 헤더파일, 다큐먼트 등을 몽땅 모아 놓은 것을 package라 부른다.)

MacPorts를 설치하기 전에 먼저 Xcode와 X11이 설치되어 있어야 한다.

웹페이지(Installing MacPorts)의 안내에 따라 MacPorts-1.7.1-10.5-Leopard.dmg를 받아서 (클릭들만으로) 설치한 후,  착실하게 MacPorts “selfupdate” command라는 것을 따라해 보니 (웬일인지) 잘된다.

Last login: Wed Jul  8 21:17:08 on ttys000
%% sudo port -v selfupdate
Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/
receiving file list ... done

sent 36 bytes  received 384171 bytes  109773.43 bytes/sec
total size is 23568484  speedup is 61.34
receiving file list ... done

sent 36 bytes  received 6909 bytes  2778.00 bytes/sec
total size is 4061730  speedup is 584.84

MacPorts base version 1.710 installed
Downloaded MacPorts base version 1.710

The MacPorts installation is not outdated so it was not updated
%%

Macports가 업데잇될 때마다 자동으로 업그레이드해 주겠다는 뜻이겠지.


2. MacPorts로 Freeimage 설치
http://guide.macports.org/ (상세한 설명)
http://trac.macports.org/wiki/UsingMacPortsQuickStart (간략한 설명)

특정 포트 검색 명령어를 써서 freeimage가 있음을 확인했다.
%% port search freeimage
freeimage @3.12.0 (graphics)
    Library for FreeImage, a dependency-less graphics library

특정 포트에 대한 정보를 보기 위한 명령어는 "port info"
%% port info freeimage
freeimage @3.12.0 (graphics)
Variants:    universal

FreeImage is a library for developers who would like to support most popular
graphics image formats. Some highlights are: extremely simple in use, not
limited to the local PC (unique FreeImageIO) and Plugin driven!
Homepage:    http://freeimage.sourceforge.net/

Platforms:            macosx
Maintainers:          toby@macports.org

이외 port command 몇 가지를 Freeimage에 대해 실행해 보면,
%% port deps freeimage
freeimage has no dependencies
%% port variants freeimage
freeimage has the variants:
    universal: Build for multiple architectures


포트를 설치하라는 명령어: "sudo port install (포트 이름)"
참고: MacPorts Guide 3.1.8. install
%% sudo port install freeimage
Password:
--->  Fetching freeimage
--->  Attempting to fetch FreeImage3120.zip from http://nchc.dl.sourceforge.net/freeimage
--->  Verifying checksum(s) for freeimage
--->  Extracting freeimage
--->  Applying patches to freeimage
--->  Configuring freeimage
--->  Building freeimage
--->  Staging freeimage into destroot
--->  Installing freeimage @3.12.0_0
--->  Activating freeimage @3.12.0_0
--->  Cleaning freeimage

무슨 파일들이 설치되었는지 확인해 보면,
%% port contents freeimage
Port freeimage contains:
  /opt/local/include/FreeImage.h
  /opt/local/lib/libfreeimage.3.12.0.dylib
  /opt/local/lib/libfreeimage.3.dylib
  /opt/local/lib/libfreeimage.a
  /opt/local/lib/libfreeimage.dylib


MacPorts.org 사이트의 포트 검색에서 Freeimage를 찾을 수 있다.
freeimage 3.12.0
    Library for FreeImage, a dependency-less graphics library
    Maintained by: toby
    Categories: graphics
    Platforms: macosx
    Variants: universal




3.


posted by maetel