Google AdSense (text)

hidden logo stop

Moving

거지 같은 이글루스 광고노출 정책이 싫어서,
새 보금자리(http://blog.leocat.kr/)로 이사감.

[MacOS] node-libxml 설치 오류 Computer & Program

cloud9을 설치하는데 설치 도중에 아래처럼 node-libxml(npm install libxml)을 설치하다가 오류가 발생했다. node.js를 homebrew로 설치해서 위치를 못 찾는건지, sudo로 실행해야 하는건지, github에 접속할 ssh권한이 부족한건지.. 도대체 알 수가 없었다. -ㅅ-;;

$ sm install
     [[ 중략 ]]

> libxml@0.0.7 preinstall [your_home]/.sourcemint/install-cache/https/github.com/ajaxorg/packager/tarball/bee2a82c6d5e2875024bfdc83937e98092ccf04f/node_modules/libxml
> ./build.sh

Checking for program g++ or c++ : /Applications/Xcode.app/Contents/Developer/usr/bin/g++
Checking for program cpp : /Applications/Xcode.app/Contents/Developer/usr/bin/cpp
Checking for program ar : /Applications/Xcode.app/Contents/Developer/usr/bin/ar
Checking for program ranlib : /Applications/Xcode.app/Contents/Developer/usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local/Cellar/node/0.8.14
'configure' finished successfully (0.235s)
Waf: Entering directory `[your_home]/.sourcemint/install-cache/https/github.com/ajaxorg/packager/tarball/bee2a82c6d5e2875024bfdc83937e98092ccf04f/node_modules/libxml/support/o3/build'
[1/3] cxx: hosts/node-o3/sh_node.cc -> build/Release/hosts/node-o3/sh_node_1.o
22:09:42 runner system command -> ['/Applications/Xcode.app/Contents/Developer/usr/bin/g++', '-g', '-O3', '-msse2', '-ffast-math', '-fno-strict-aliasing', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_GNU_SOURCE', '-IRelease', '-I..', '-IRelease/include', '-I../include', '-IRelease/hosts', '-I../hosts', '-IRelease/modules', '-I../modules', '-IRelease/deps', '-I../deps', '-I/usr/local/Cellar/node/0.8.14/include/node', '../hosts/node-o3/sh_node.cc', '-c', '-o', 'Release/hosts/node-o3/sh_node_1.o']
In file included from /usr/local/Cellar/node/0.8.14/include/node/v8.h:41,
                 from ../hosts/node-o3/sh_node.cc:21:
/usr/local/Cellar/node/0.8.14/include/node/v8stdint.h:34:19: error: stdio.h: No such file or directory
/usr/local/Cellar/node/0.8.14/include/node/v8stdint.h:50:20: error: stdint.h: No such file or directory

     [[ 중략 ]]

../deps/libpng/pngwutil.c: In function ‘void o3::png::png_write_sCAL(o3::png::png_struct*, int, double, double)’:
../deps/libpng/pngwutil.c:1618: error: ‘snprintf’ was not declared in this scope
../deps/libpng/pngwutil.c:1619: error: ‘strlen’ was not declared in this scope
../deps/libpng/pngwutil.c: In function ‘void o3::png::png_write_finish_row(o3::png::png_struct*)’:
../deps/libpng/pngwutil.c:1877: error: ‘memset’ was not declared in this scope
../deps/libpng/pngwutil.c: In function ‘void o3::png::png_do_write_interlace(o3::png::png_row_info*, o3::png::png_byte*, int)’:
../deps/libpng/pngwutil.c:2069: error: ‘memcpy’ was not declared in this scope
Waf: Leaving directory `[your_cloud9_dir]/node_modules/libxml/support/o3/build'
Build failed:
-> task failed (err #1):
{task: cxx sh_node.cc -> sh_node_1.o}
-> task failed (err #1):
{task: cxx sh_node_libs.cc -> sh_node_libs_1.o}
  File "/usr/local/Cellar/node/0.8.14/bin/node-waf", line 16, in
Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
  File "/usr/local/Cellar/node/0.8.14/bin/../lib/node/wafadmin/Scripting.py", line 147, in prepare
error(str(e))
cp: build/Release/o3.node: No such file or directory
npm ERR! libxml@0.0.7 preinstall: `./build.sh`
npm ERR! `sh "-c" "./build.sh"` failed with 1
npm ERR!
npm ERR! Failed at the libxml@0.0.7 preinstall script.
npm ERR! This is most likely a problem with the libxml package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./build.sh
npm ERR! You can get their info via:
npm ERR!     npm owner ls libxml
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 11.4.2
npm ERR! command "/usr/local/Cellar/node/0.8.14/bin/node" "/usr/local/bin/npm" "install" "libxml"
npm ERR! cwd [your_cloud9_dir]
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.65
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     [your_cloud9_dir]/npm-debug.log
npm ERR! not ok code 0
$


몇 시간을 살펴보니 dependency로 libxml을 설치하는 도중, libxml에 링크가 걸려 있는 o3가 설치되지 못 하는 것을 발견했다. (출력 중간에 있는 build/Release/o3.node: No such file or directory 부분이 o3가 컴파일된 경로인 것 같다.) 아래의 화면 출력를 보면 o3를 설치하면서 stdio.h, stdint.h 등 기본적인 c++ 라이브러리를 찾지 못 하는 것을 볼 수 있다.

XCode도 설치되어 있기 때문에 당연히 있는 내용들인데 찾지 못 하는 것이 이상하다. 꽤 오랜 구글링 끝에.. 저 XCode에 포함된 g++은 반쪽짜리라는 것을 발견했다. (C++ Hello World trouble on OSX10.8) 답변으로 설명된 것 처럼 XCode에서 "Cmd + ,"를 눌러서 설정 창을 열고 "Command Line Tools"를 설치하면 된다. 테스트로 libxml이 설치되는지 확인해보면 g++, cpp, ar, ranlib 등의 경로가 바뀐 것을 볼 수 있다.


$ npm install libxml
npm http GET https://registry.npmjs.org/libxml
npm http 304 https://registry.npmjs.org/libxml

> libxml@0.0.7 preinstall [your_cloud9_dir]/node_modules/libxml
> ./build.sh

Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local/Cellar/node/0.8.14
'configure' finished successfully (0.288s)

     [[ 중략 ]]
$


+ 아~ 지금 몇 시니 TㅅT 그나저나 cloud9은 왜 프로젝트를 못 잡지..?? 원하는대로 바로 되는게 하나도 없고마잉~ ㅋㅋ


- 참고
C++ Hello World trouble on OSX10.8

덧글

댓글 입력 영역

Google AdSense (text/image)