manywaypark's Blog
개발, 검색, 함수

erlang + autotools + rebar

tips & tricks/Linux/Unix 2014. 4. 11. 18:18 by manywaypark

항상 멋진 도구를 찾아내고 나면 기쁨 뒤에 후회와 허탈함이 밀려온다.

'좀더 찾아볼걸... Orz'

'이거 해결하려고 쓴 시간이 얼마인가... ㅠㅠ'

여튼 erlang에서 autotools와 rebar등을 묶어줄 뿐만 아니라 .deb package까지도 만들어주는 멋진 놈이 존재하고 있었던 것이다.

(물론 erlang 말고 javascript, c, c++도 지원함)

또한 추가적으로 대부분의 메이저 scm도 지원하며, 빌드번호 등도 관리되는 듯하다. 넘 멋지다.

이젠 잘 쓰는 일만 남았다.


refs: 

http://dukesoferl.blogspot.kr/2008/02/erlang-and-automake.html

https://code.google.com/p/fwtemplates/


happy hackin'


ps. 이런 식으로 쓴다.

$ fw-init --name prj-name --template erlang-rebar --revision git


나는 startxwin으로 MS windows에서 창으로 표시되는(windowed mode?) 형태로 주로 사용했는데, 데스크탑을 보고 싶다는 사용자의 요구(?)가 있어서 좀 찾아보았다.

대충 startx 같은거 실행하면 깔려있는 기본 WM이 뜬다(local에서 X server가 실행되는 방식).

XDMCP를 사용하면 완전히 서버에 client로 접속하는 것같다. 아래처럼 한다.

# 일반적으로 접속

X -query remote_hostname_or_ip_address

# 여러 서버 접속

X :0 -query remote_hostname_or_ip_address

X :1 -query remote_hostname_or_ip_address


refs: 

http://x.cygwin.com/docs/ug/using-window-managers.html

http://x.cygwin.com/docs/ug/using-remote-session.html

http://jamesmcdonald.id.au/it-tips/cygwin-startxdmcp-bat-displays-blankblack-x-window -> XDMCP 문제해결. DHCP 환경?


debug/release mode on linux

tips & tricks/Linux/Unix 2014. 3. 31. 14:32 by manywaypark

autotools 또는 configure 사용시 debug 정보 넣기


$ mkdir debug

$ mkdir release

$ cd debug && /path/to/configure --prefix=/dbg CPPFLAGS=-DDEBUG CXXFLAGS="-g -O0" && make && make install

$ cd ../release && /path/to/configure CPPFLAGS=-DNDEBUG && make && make install

debug에는 debug 정보가 포함된 바이너리가 생기고 release에는 debug 정보가 포함되지 않은 바이너리가 생긴다.

install target directory(prefix)가 다른 것에 주의한다.


box 레벨에서는 다음과 같이 해서 파일을 하나 생성해두면 prefix를 /dbg 로 해서 configure를 실행한 경우 자동으로 debug 정보를 포함하게 된다.

echo 'CPPFLAGS=-DDEBUG CFLAGS="-g -O0"' >> /dbg/share/config.site


ref: http://stackoverflow.com/questions/4553735/gnu-autotools-debug-release-targets


happy hackin'



core file은 어디에??

tips & tricks/Linux/Unix 2014. 3. 21. 18:19 by manywaypark

아래와 같은 어마무시한 메시지가 나왔는데...

Segmentation fault (core dumped)

'코흘리던 시절 많이 보던 거지만, 간만에 보니 새롭다.' 라는 감상에 잠시 빠졌다가...

고쳐야지 하고 봤는데 파일이 없다. Orz.

분명히 core 파일은 CWD(current working directory)에 생성되는데... 잠시 맨붕.

좀 뒤져보니 그동안 많은 변화가 있었던듯...

여튼 /proc/sys/kernel/core_pattern 파일에서 core 관련 처리에 관해서 정의하고 있었고 (bar(|)로 시작하면 리다이렉션 한다든지 하는 제법 향상된 기능을 제공), 내 경우(Ubuntu) 아래와 같이 설정되어 있었고,

|/usr/share/apport/apport %p %s %c

apport라는 놈이 /var/crash에 많은 정보를 포함한 파일을 남기고 있었다.

그 파일들은 apport-unpack이라는 utility로 풀 수 있는데 그 안에 CoreDump 파일이 있었다.


ref: http://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory


happy hackin'


ps. 후일[각주:1]을 위해 간단히 backtrace하는 방법도 남김

(별거 없고 그냥 실행파일과 core 파일을 파라미터로 해서 gdb 실행 시킨후 bt 명령으로 backtrace하면 됨).

gdb /path/to/executable /path/to/CoreDump

GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04

Copyright (C) 2012 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "x86_64-linux-gnu".

......

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Core was generated by `/usr/lib/erlang/erts-5.8.5/bin/beam.smp -- -root /usr/lib/erlang -progname erl'.

Program terminated with signal 11, Segmentation fault.

#0  0x00007f3528fb5f28 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)

    () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

(gdb) bt

#0  0x00007f3528fb5f28 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)

    () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

......


2018-04-03 추가[각주:2]:

core file 생성되었다는 메시지만 나오고 아무데도 생성되지 않는 경우가 발생했는데...

ulimit -a 해보면 core file size가 0으로 되어있다. 머지 이건?

여튼 ulimit -c unlimited 해준 후에 실행하면 현재 작업 디렉토리에 core 파일이 생성되었다.

ref: https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory

  1. core 파일은 진짜 몇년만에 처음본다. 그래서 몇년 뒤에 참조할 일이 생길지도... [본문으로]
  2. 진짜 몇년 지나서 또 보게 되었구나. 구글링하다 갑자기 내가 쓴 글이 생각났다. Orz. [본문으로]

Autotools로 library 만들기

tips & tricks/Linux/Unix 2014. 2. 27. 16:56 by manywaypark

아주 잘 정리된, 간략한 페이지가 있구나.

http://www.openismus.com/documents/linux/building_libraries/building_libraries


happy hackin'


먹고 살려고 windows 환경에서 emacs를 쓰고 있는데, 어느 순간엔가 제목과 같은 에러가 나면서 emacs가 시작조차 되지 않았다.

emacs가 안되면 나는 아무것도 할 수 없는 상태... 완전 맨붕.

*Messages* buffer의 내용은 아래와 같았다.

......

Desktop: 367.00ms to restore ~/.emacs.d/custom.el

Entering debugger...

condition-case: Variable binding depth exceeds max-specpdl-size

Error in post-command-hook (global-rinari-mode-check-buffers): (error "Variable binding depth exceeds max-specpdl-size")

Mark activated

rinari-root: Lisp nesting exceeds `max-lisp-eval-depth'

......

검색해봐도 별로 유의미한 것은 없었고 rinari는 ruby 관련 패키지라는 것 말고는 알아낸게 없었다 (난 ruby 쓰지도 않음).

얼마전부터 개별 패키지 설치를 하지 않고(너무 많아서 귀찮음) 대부분의 각종 설정을 해주는 emacs.d를 잘 쓰고 있었는데 거기에는 desktop이라는 패키지도 기본으로 포함되어 있었다. emacs 종료 직전의 상태(열린 파일 즉 버퍼 등)로 복구해주는 아주 유용한 패키지인데, 파일들을 열다가 상기 메시지를 뿌리는 것으로 보아 좀 의심이 갔다. 설정 파일(~/.emacs.d/.emacs.desktop)을 열어 보았다.
에러 메시지를 뿌리기 직전 custom.el을 열고 그 다음에 remote server의 파일(//으로 시작하는 path)을 열면서 에러가 난 것으로 추정되었다.

기억을 더듬어 보니 며칠전에 remote file server에 있는 파일을 drag & drop으로 열려고 시도했는데 제대로 열리지 않아서 local로 옮겨서 열었던것이 용케 떠올랐다 (사실 rebooting 요구하는 windows update만 안했어도 몇주 이상 더 띄워 놓았을 거다).
해당 부분을 파일에서 삭제하고 emacs를 시작했더니 제대로 올라왔다.
해당 부분(lisp expression 이다):
(desktop-create-buffer 206
  "//a.file.server/path/to/file"
  "file"
  'fundamental-mode
  '(anzu-mode global-auto-revert-mode whitespace-cleanup-mode undo-tree-mode whole-line-or-region-mode hes-mode auto-compile-on-load-mode)
  1
  '(nil nil)
  nil
  nil
  '((buffer-file-coding-system . iso-latin-1-dos)))

간만에 구글느님께서도 정답을 알려주지 못하는 문제가 생겨서 삽질좀했다.

happy hackin'



MSBuild.exe MyProj.proj /property:Configuration=Debug

ref: http://msdn.microsoft.com/en-us/library/dd393574.aspx


happy hackin'

erlang name clash

함수형 언어/Erlang 2014. 1. 15. 10:29 by manywaypark

code:clash()를 쓰면 이름 충돌에 관한 정보가 나온다.

code:get_path(), code:add_patha(), code:add_pathz() 등으로 조회, 추가 등을 할 수 있다.

erl 수행시 -pa, -pz  등의 옵션을 쓰는 방법도 있다.


ref: http://erlang.org/pipermail/erlang-questions/2012-February/064179.html


happy hackin'

그냥 간단하게 미리 빌드된 rebarwget을 써서 가져다 쓰려고 했는데 다음과 같은 에러가 나면서 아예 받아오지를 못했다.

$ wget https://raw.github.com/wiki/rebar/rebar/rebar && chmod u+x rebar

--2014-01-13 14:27:23--  https://raw.github.com/wiki/rebar/rebar/rebar

Resolving raw.github.com (raw.github.com)... 103.245.222.133

Connecting to raw.github.com (raw.github.com)|103.245.222.133|:443... connected.

ERROR: The certificate of `raw.github.com' is not trusted.

ERROR: The certificate of `raw.github.com' hasn't got a known issuer.


--no-check-certificate 옵션을 추가하면 해결되는데, 원래는 이렇게 쓰면 안될거같은데... 

$ wget --no-check-certificate https://raw.github.com/wiki/rebar/rebar/rebar && chmod u+x rebar


happy hackin'


2015-01-16: ca-certificates 패키지 까는 것이 정공법이다.

[git] gitolite admin public key 교체.

tips & tricks 2013. 12. 23. 16:51 by manywaypark

완전 똑같은 문제에 대한 참조가 있었다.

핵심은 그냥 설치된 머신에서 gitolite user(보통 git)로 변신(su)한 후에 clone한 후에 push하는 것인데 후처리가 필요하므로 gl-admin-push를 쓰는 것이다.

su git

cd /tmp && git clone /path/to/gitolite-admin.git

# keydir 내의 admin.pub key 교체

~/.gitolite/src/gl-admin-push # apt package manager를 써서 설치한 경우는 /usr/share/gitolite/gl-admin-push


ref: http://stackoverflow.com/questions/7033991/gitolite-access-repair


happy hackin'


2017-09-15 추가: gitolite 최신 버전은 여기 참조 http://gitolite.com/gitolite/emergencies/index.html

1 ··· 8 9 10 11 12 13 14 ··· 31 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

05-19 08:04