'OSX'에 해당되는 글 38건

  1. 2010.06.01 Emacs xcode-compile
  2. 2010.05.29 i386 compilation
  3. 2010.05.25 매트랩 라이브러리 링크시 아키텍처 오류
  4. 2010.05.25 How to change MAC adreess in OSX
  5. 2010.05.06 TCP/IP example
  6. 2010.03.25 Xcode and svn
  7. 2010.03.18 Environment variables in OSX
  8. 2010.03.09 Bash profile
  9. 2010.03.08 Shortcut in Unix/Linux/OSX
  10. 2010.03.03 NAO installation 3

Emacs xcode-compile

OSX 2010. 6. 1. 17:31

이번에는 Emacs에서 Xcode project를 build하는 것이다.

다음의 emacs lisp 코드를 .emacs 파일안에 넣어놓으면 M-x xcode-compile이 나 F10키로 바로 컴파일이 가능하다.

  1. (defvar xcode-compile-sdks nil)  
  2. (defvar xcode-compile-sdk-history nil)  
  3.   
  4. (dolist (line  
  5.          (split-string  
  6.           (with-temp-buffer  
  7.             (call-process "xcodebuild" nil t nil "-showsdks")  
  8.             (buffer-string))  
  9.           "\n" t)  
  10.          )  
  11.   (let ((comps (split-string line "-sdk " t)))  
  12.     (if (> (length comps) 1)  
  13.         (add-to-list 'xcode-compile-sdks (car (last comps)))  
  14.       )  
  15.     )  
  16.   )  
  17.   
  18. (defun xcode-compile ()  
  19.   (interactive)  
  20.   (let ((command "xcodebuild -activeconfiguration -activetarget"))  
  21.     (setq command  
  22.           (concat  
  23.            command  
  24.            (if xcode-compile-sdks  
  25.                (let ((default-sdk (or (car xcode-compile-sdk-history) (car xcode-compile-sdks))))  
  26.                  (concat  
  27.                   " -sdk "  
  28.                   (completing-read  
  29.                    (format "Compile with sdk (default %s): " default-sdk)  
  30.                    xcode-compile-sdks  
  31.                    nil  
  32.                    t  
  33.                    nil  
  34.                    'xcode-compile-sdk-history  
  35.                    default-sdk  
  36.                    )  
  37.                   )  
  38.                  )  
  39.              )  
  40.            (let ((dir ".") (files nil))  
  41.              (while  
  42.                  (progn  
  43.                    (setq files (directory-files dir nil "\\.xcodeproj\\'"))  
  44.                    (and (not (string-equal "/" (expand-file-name dir))) (null files))  
  45.                    )  
  46.                (setq dir (concat (file-name-as-directory dir) ".."))  
  47.                )  
  48.              (unless (null files) (concat " -project " (file-name-as-directory dir) (car files)))  
  49.              )  
  50.            )  
  51.           )  
  52.     (compile (read-string "Compile command: " (concat command " ")))  
  53.     )  
  54.   )  
  55.   
  56. (define-key global-map [f10] 'xcode-compile)

http://han9kin.doesntexist.com/29#recentTrackback

:

i386 compilation

OSX 2010. 5. 29. 17:21

I was able to compile as universal (on Leopard) with: CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc -DCRYPTOPP_DISABLE_ASM" make

lipo -info /opt/local/lib/libboost_filesystem.dylib

:

매트랩 라이브러리 링크시 아키텍처 오류

OSX 2010. 5. 25. 22:28

/Applications/MATLAB2009a/MATLAB_R2009a.app/bin/maci/libmx.dylib, file

is not of required architecture
:

How to change MAC adreess in OSX

OSX 2010. 5. 25. 14:55
여러가지 이유로 Airport의 Mac Address를 변경해야할 필요성이 있습니다.
구글링을 해보면 2-3가지의 Apps, 스크립트들이 있으나 어찌된 것이 현 OSX 10.5.6에서는 효과가 없더군요.
그러다가 다음에서 방법을 찾았습니다. http://curtisschweitzer.net/blog/?p=2152
요약하면

1. 상단 메뉴 Airport 아이콘을 클릭, "다른 네트워크에 연결"을 선택
2. 네트워크 이름을 입력하십시요...에서 가상의 SSID를 입력 (Airport가 찾지 못하도록, 예; Fake SSID, TEST SSID.....) 후
3. 연결 버튼을 클릭하면, Airport가 해당 SSID를 찾지 못하고 헤메게 됩니다. Airport 아이콘을 보면 신호강도가 없는 것 처럼 보입니다.
=> 바로 이 때가 Airport Mac Address를 바꿀 수 있는 찬스!
4. 터미널을 열고
sudo ifconfig en1 lladdr xx:xx:xx:xx:xx:xx
라고 입력후 패스워드 입력하면 완료!
5. ifconfig en1 을 입력해 보면 바뀐 Mac이 보일겁니다.

단, 시스템환경설정 혹은 네트워크 유틸리티 에서 보이는 Mac 주소는 Airport의 기본 Mac주소가 계속 보입니다.
이는 Airport의 Mac Address를 Software적으로만 바꾼것이며 전원을 껐다 다시 켜면 초기상태로 원복됩니다.


:

TCP/IP example

OSX 2010. 5. 6. 11:13
:

Xcode and svn

OSX 2010. 3. 25. 22:34

xCode에서 작업하다가 SVN 서버상에 커밋한번 하려고 parallel window를 키고 거북이SVN 사용하는 것이 너무 귀찮아서 xCode에 SVN을 셋팅하게 되었는데, 서버상에 폴더를 나누어 관리하다가 보니 xCode하고 연동이 잘 안되더군요. -_-;


그래서 이리저리 해보다가 방법을 찾았습니다.(하지만 별건 아닌;;;)
결 론은 SVN 서버 경로에 프로젝트 파일이 있어야 된다...인데, 아무리 생각해도 이렇게 안해도 될 것 같습니다. 포스팅하고 검색해봐야겠네요;;;
1. 먼저 서버에 관리할 소스코드를 모두 import 합니다.(아 래와 같이 폴더가 나누어져 있습니다.)

2. xCode를 실행하여 메뉴의 SCM - Configure SCM Repositories를 선택합니다.
3. 오른쪽 밑의 +를 선택해서 새로 하나 만듭니다.

4. URL에 미리 올려둔 소스코드상에서 xCode 프로젝트 파일이 있는 경로를 적어줍니다. 적고 커서를 다른 곳으로 옮기면 밑부분이 알아서 채워집니다.(user, password 까지 알아서 채워집니다. 맨 밑에 확인 메세지가 뜨나만 확인하시면 됩니다.) 생성하고 메뉴 - SCM - Repositoes를 선택해봅니다.
5. 밑과 같이 뜨는데, 생성한 repository를 선택해서 파일들이 제대로 뜨나 확인합니다.
에서
와 같이 변경되겠죠.

6. 확인되었으면 check out을 적당한 디렉토리에 합니다. 그러면 아래와 같은 메세지가 뜨는데, 열어줍니다.(폴더에 xCode프로젝트가 없으면 아래와 같은 메세지가 안뜨더군요. 이거랑 연동하는거랑 연관있는지는 잘 모르겠습니다.-_-;)

7. 메뉴 - SCM을 보시면 아래와 같이 변해있는데, this project 선택합니다.

8. info가 뜨는데요, 아래와 같은 버튼이 보입니다. 선택해주시면...

9. 나오는 화면에서 repository 부분의 메뉴를 선택하면 아래와 같이 펼쳐집니다. 여러개 있으면 보이는 것처럼 여러개가 나오지요. 해당하는 repository를 선택합니다.

10. 일단 셋팅은 되었습니다. 확인해보려면 xCode의 프로젝트 트리메뉴 상단에 Groups & Files를 우클릭하여 나오는 아래와 같은 화면에서 SCM을 선택합니다.

11. Groups & Files 바로 왼쪽에 없던 통(?)아이콘이 하나 생겼을겁니다. 제대로 연동이 된다면 소스코드를 변경시에 아래와 같이 M이 나옵니다.

12. commit 되는 것들을 한번에 확인하려면 shift-command-v를 눌러서 result 창을 엽니다.(메뉴 - SCM - SCM Results)

13. commit할 것들이 주르륵 뜹니다. 여기서 우클릭해서 commit해도 되고, 메뉴 - SCM - commit entire project를 해도 되고, xCode에서 파일 우클릭하고서 commit해도 됩니다(하나만 하기, 한번에 다하기 등 기능은 조금씩 틀리겠지라고 예상하고 있습니다. -_-;)

적고보니 xcode에 SVN 셋팅하기가 되어버렸네요;;; 그래도 적은시간이 아까우니 포스팅은 해야;;;

이렇게 해놓으니 각각의 프로젝트가 xcode 상에서 SVN 서버와 잘 연동되어 commit하기가 쉬워지네요. paralles window 키고, 거북이SVN 쓸때와는 차원이 틀립니다. ㅜㅜ 어떻게 했는지 이거원;;;;

하다가 불편해지면 다른 방법을 찾아봐야겠습니다. ^^
:

Environment variables in OSX

OSX 2010. 3. 18. 21:25

방법은, ~/.MacOSX/environment.plist 파일에다 LC_CTYPE의 키와 함께 ko_KR.UTF-8 값을 추가해 주면 됩니다. 만약 이 파일이 존재하지 않는다면, 터미널에서 다음과 같은 명령을 실행해 줍니다:

코드:

mkdir ~/.MacOSX
echo "{ LC_CTYPE = \"ko_KR.UTF-8\"; }" > ~/.MacOSX/environment.plist
:

Bash profile

OSX 2010. 3. 9. 11:22

쉘을 써보려면 당연히 Terminal 이 필요 하다.


Terminal 은 위의 스샷과 같이 Application-> Utility 에 존재 한다

> export
declare -x SHELL='/bin/bash'

위에서 보는 바와 같이 Mac OS X 의 default Shell은 Fedora나 Ubuntu 와 마찬가지로 Bash Shell 이다.

Bash shell 은 bashrc 라는 파일을 이용해서 Customizing 할 수 있다.

/etc/bashrc 라는 파일이 모든 유저에게 적용되는 bashrc 파일이고

Ubuntu 나 Fedora 에서는 $HOME/.bashrc 파일을 생성 ( 대부분 이미 생성되어 있다 ) 하여 유저별 Customizing 이 가능하다.

내가 이글을 쓰고 있다는 얘기는 $HOME/.bashrc 가 동작하지 않는 다는 얘기다.

.bashrc 를 불러 주는 건 .bash_profile 이다..

그래서 .bash_profile 을 찾아 보았는데 , 이것도 없다 ㅎㅎ

# .bash_profile

if [ -f ~/.bashrc]; then
        . ~/.bashrc
fi


위와 같이 .bash_profile 을 생성해주면

이제 Terminal 을 실행 실킬때 bashrc 를 실행 해주게 된다. :)
:

Shortcut in Unix/Linux/OSX

OSX 2010. 3. 8. 00:16

sudo ln -s /Applications/MATLAB_R2008b.app/bin/matlab /usr/bin/matlab

:

NAO installation

OSX 2010. 3. 3. 17:20

Installation

Follow the steps below to install the SDK on your Mac OS X computer:

  1. Download "Mac Leopard nao SDK" from the Aldebaran website.
  2. Extract the contents of the SDK (.tar.gz) file in a directory (for example in "~/naoqi/").
  3. Create an environment variable AL_DIR: export AL_DIR="/home/mylogin/naoqi/" (of course, change 'mylogin' by your login). It can be useful to set it in the .bashrc file for permanent export.
    Note:

    AL_DIR must be set to the directory which contains the README file.

We are now ready to compile nao SDK examples.

Warning:

Remember that the Cross compilation is only available for Linux.


Compilation instructions (HelloWorld sample)

There are two ways to compile a module:

  • As an executable (remote modules): each modules package creates an independent executable stored in "$AL_DIR/modules/bin/". At startup you need to specify the IP and the port of the NaoQi running.
  • As a library: each modules package creates a dynamic library stored in "$AL_DIR/modules/lib/". To make this library loaded by NaoQi, the $AL_DIR/module/lib/autoload.ini file needs to be updated with the name of your modules library.

CMake compilation tools is used to generate make or IDE project (XCode, ...).

Compiling modules as executable

Follow the steps below to compile NaoQi SDK examples as executable:

  1. Be sure that the NaoQi executable and modules packages are not running.
  2. Go to the $AL_DIR/modules/src/examples/ directory.
  3. Create and jump into a temporary build directory (example $AL_DIR/modules/src/examples/build/).
  4. Run cmake ..
  5. Run the configuration command ccmake ..
  6. Be sure that the HELLO_WORLD_IS_REMOTE option is set to ON.
  7. Reconfigure by pressing c.
  8. Quit cmake configuration by pressing g.
  9. Then compile: make. The generated binaries are copied to the modules/bin directory.
  10. Edit the autoload.ini file ($AL_DIR/modules/lib/autoload.ini).

    > The line helloworld must not be present.

    > "Autoload.ini" is used to load dynamic library at startup.

Note:

At anytime, you can reset your project by deleting contents of the build directory and relaunch 'cmake ..'

Note:

You can generate a XCode project with the command cmake -G XCode ..

Note:

Many options are available with cmake, refer to the CMake website for further information.

Now let's start modules packages executable:

  1. Start the main broker by launching NaoQi executable ($AL_DIR/bin/naoqi).
  2. Start helloworld executable ($AL_DIR/modules/bin/helloworld).

    > You will see some log in the mainbroker terminal.

  3. Run the python file to test helloworld:

    a. cd $AL_DIR/modules/src/examples/helloworld/test

    b. python test_mymodule.py

At this point, the log message "Info : MyModule : Hello World!" is printed on the mainbroker (NaoQi) terminal.

Note:

If a module package is compiled as an executable, you can connect it to the robot by editing the IP (and port if needed) of the main broker in the test_helloworld.rb file.

Note:

Once you have launched a broker, you can see the generated API http web page by using the IP and the port of this broker : http://127.0.0.1:9559 . Here you can find modules and methods descriptions.

Warning:

The socket server may not be available when starting NaoQi. Two things can lead to this situation:

- NaoQi crashed: wait few seconds, the operating system is going to free the socket.

- NaoQi is still alive: kill NaoQi and restart.

Compiling modules as dynamic library

Follow the steps below to compile NaoQi SDK examples as library:

  1. Be sure that NaoQi executable and modules packages are not running.
  2. Go to the $AL_DIR/modules/src/examples/ directory.
  3. Create and jump into a temporary build directory (example: $AL_DIR/modules/src/examples/build/).
  4. Run cmake..
  5. Run the configuration command ccmake..
  6. Switch OFF the HELLOWORLD_IS_REMOTE option.
  7. Reconfigure project by pressing c.
  8. Quit cmake configuration by pressing g.
  9. Then compile: make..

    > The generated libraries are copied to the modules/lib directory ($AL_DIR/modules/lib/helloworld.so).

  10. Edit the autoload.ini file ($AL_DIR/modules/lib/autoload.ini) by adding this line: helloworld (before the [remote] line).
  11. Start NaoQi executable ($AL_DIR/bin/naoqi).

    > The mainBroker starts and the module MyModule is loaded (cf log message).

  12. Run the python file to test helloworld:

    a. cd $AL_DIR/modules/src/examples/helloworld/test

    b. python test_mymodule.py

At this point, the log message "Info : MyModule : Hello World!" is printed in the mainbroker (NaoQi) terminal.

Warning:

The socket server may not be available when starting NaoQi. Two things can lead to this situation:

- NaoQi crashed: wait few seconds, the operating system is going to free the socket.

- NaoQi is still alive: kill NaoQi and restart.

: