man page도 존재하지 않아서 확신은 못하겠지만

# python-config --help
Usage: /usr/local/bin/python-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--help]

# python-config --prefix
/usr/local

# python-config --exec-prefix
/usr/local

# python-config --includes
-I/usr/local/include/python2.6 -I/usr/local/include/python2.6

# python-config --libs
-lpthread -ldl -lutil -lm -lpython2.6

# python-config --cflags
-I/usr/local/include/python2.6 -I/usr/local/include/python2.6 -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

# python-config --ldflags
-L/usr/local/lib/python2.6/config -lpthread -ldl -lutil -lm -lpython2.6

-I -L 옵션이 나오는것 봐서는
이녀석을 통해서 gcc 컴파일시(python/c api) 사용할 옵션을 빼내주는 것으로 보인다.
아무래도 컴파일 시에 준 옵션 보다는 직접 파일을 검색하는 느낌이 강하게 든다.(바로바로 결과가 안나온다)

결과를 봐서는, ldflags 와 cflags 두개만 사용하면 될듯하다.

[링크 : http://hltbra.blogspot.com/2010/02/introducao-pythonc-api.html]
Posted by 구차니
하드웨어2010. 3. 3. 16:14
혹시 E5400 이라고 붙은 이유가..
bogomips로 5400이 나와서 그런건 아니겠지? ㄱ-

아무튼 단순 수치상으로 2개 프로세서니까, 10800MIPS가 되는걸려나?

# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Pentium(R) Dual-Core  CPU      E5400  @ 2.70GHz
stepping        : 10
cpu MHz         : 2700.095
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
bogomips        : 5403.74

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Pentium(R) Dual-Core  CPU      E5400  @ 2.70GHz
stepping        : 10
cpu MHz         : 2700.095
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
bogomips        : 5400.07


2009/11/12 - [하드웨어 관련] - BogoMIPS - cpu 성능 측정하는 방법중 하나


Pentium(R) Dual-Core  CPU      E5400  @ 2.70GHz
bogomips        : 5403.74

Intel(R) Pentium(R) D CPU 3.00GHz
bogomips        : 5988.40

Intel(R) Xeon(R) CPU           X3320  @ 2.50GHz
bogomips        : 6236.74

Intel(R) Pentium(R) 4 CPU 2.66GHz
bogomips    : 5319.93

Intel(R) Pentium(R) M processor 1.20GHz under Portable Ubuntu TRES (9.10)
bogomips    : 5872.02 / 5319.93 / 4246.73
bogomips    : 2510.02 (Speed Step to 600Mhz)

Intel XScale-PXA255 rev 6 (v5l)
BogoMIPS        : 396.56

STb7100 Reference board (SH4)
bogomips        : 262.14

STBx25xx (PPC)
bogomips        : 250.36


Posted by 구차니
Microsoft/Windows2010. 3. 3. 14:08
컴퓨터가 맛탱이가 가서 새로운 하드에 설치후,
기존 하드에서 내 문서를 복사하려는데 "엑세스가 거부되었습니다."
라는 오류가 발생을 했다. 이래저래 찾는데 영~ 안되다가 겨우겨우 컴치초탈님의 블로그에서
딱 필요한 ms 공식 링크를 발견했다.

그나저나.. Win7 시대에 WinXP 글이라니 ㅠ.ㅠ
Win7으로 가야하나? ㅋ

Step 1. 들어가지지 않는 폴더의 등록정보를 본다.
           그런데 아래와 같이 일반/공유 탭만 나온다면

Step 2. 폴더 옵션에서 "모든 사용자에게 동일한 폴더 공유 권한을 지정(권장)" 을 해제한뒤

Step 3. 다시 들어가보면 다음과 같이 "보안" 탭이 나타납니다.
           그리고 "고급(V)" 버튼을 눌러 들어가서

Step 4. "소유자" 탭에서 특정 계정(귀찮으면 Administrator나 Administrators)을 선택 후
           "하위 컨테이너와 개체의 소유자 바꾸기(R)"체크후 적용이나 확인을 누릅니다.

그러면 폴더를 열어서 읽고 쓸수 있습니다만,
특정 폴더의 경우 재귀적으로 되지 않아, 수작업으로 이러한 소유권을 추가로 가져와야 합니다.

[링크 : http://mycom.kr/329]
-> [링크 : http://support.microsoft.com/kb/810881/ko]
Posted by 구차니
Linux2010. 3. 2. 18:29
alias make='make -j'
를 해놨는데

gmake는 symbolic link로 make로 되어있다.

하지만 alias 특성상, 명령줄 치환을 하기 때문에
입력 당시 gmake가 비록 링크 추적으로 인해서 make가 실행되겠지만,
그렇다고 해서 make가 make -j로 치환되지는 않는다.

2010/03/02 - [프로그램 사용/gcc] - make, gmake
2010/02/26 - [Linux] - make를 더욱 빠르게 하기!


Posted by 구차니
make와 gmake는 유사하나
Fedora Core 6 에서는 실질적으로 symbolic link로 연결이 되어있다.

# ll /usr/bin/*make
lrwxrwxrwx 1 root root      4 Feb 16 13:23 /usr/bin/gmake -> make
-rwxr-xr-x 1 root root 162204 Jul 13  2006 /usr/bin/make

[링크 : http://linux.die.net/man/1/gmake]
[링크 : http://linux.die.net/man/1/make]

shenzhen{bzhu}$ gmake -version
GNU Make version 3.71, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

shenzhen{bzhu}$ make -version
GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

[링크 : http://www.unix.com/high-level-programming/29191-what-distinguish-between-gmake-make.html]

아무튼, 다르지만 실질적으로 같은 녀석이다.
Posted by 구차니
프로그램 사용/gcc2010. 3. 2. 17:34
gcc 옵션중에 헷갈리는게 있다.
-L과 -l이 그녀석인데, 비슷비슷해서 조금 헷갈린다.

아무튼 -L은 디렉토리(경로)를
-l은 특정 라이브러리 파일을 설정하는데 사용된다.

       -l library
           Search the library named library when linking.  (The second alternative with the library as a separate argu-
           ment is only for POSIX compliance and is not recommended.)

           It makes a difference where in the command you write this option; the linker searches and processes libraries
           and object files in the order they are specified.  Thus, foo.o -lz bar.o searches library z after file foo.o
           but before bar.o.  If bar.o refers to functions in z, those functions may not be loaded.

           The linker searches a standard list of directories for the library, which is actually a file named libli-
           brary.a.  The linker then uses this file as if it had been specified precisely by name.

           The directories searched include several standard system directories plus any that you specify with -L.

           Normally the files found this way are library files---archive files whose members are object files.  The
           linker handles an archive file by scanning through it for members which define symbols that have so far been
           referenced but not defined.  But if the file that is found is an ordinary object file, it is linked in the
           usual fashion.  The only difference between using an -l option and specifying a file name is that -l sur-
           rounds library with lib and .a and searches several directories.

       -Ldir
           Add directory dir to the list of directories to be searched for -l.

       LIBRARY_PATH
           The value of LIBRARY_PATH is a colon-separated list of directories, much like PATH.  When configured as a
           native compiler, GCC tries the directories thus specified when searching for special linker files, if it
           can’t find them using GCC_EXEC_PREFIX.  Linking using GCC also uses these directories when searching for
           ordinary libraries for the -l option (but directories specified with -L come first).

[링크 : http://linux.die.net/man/1/gcc]
Posted by 구차니
C 에서 python을 불러서 사용하는 방법인데, 아직 복잡한 예제는 발견하지 못했다.

테스트한 플랫폼은
Fedora Core 6
Python 2.4.3 이다.

# cat py.c
#include <Python.h>

int main()
{
        Py_Initialize();
        PyRun_SimpleString("print 'Hello Python C/API'");
        Py_Finalize();
        return 0;
}

[링크 : http://koichitamura.blogspot.com/2008/06/this-is-small-python-capi-tutorial.html]

# gcc py.c -I/usr/include/python2.4 -lpython2.4
# a.out
Hello Python C/API


이렇게 메시지가 출력된다.

아마 2.4와 2.6이 혼합되어 설치되어있고, 2.6이 정상설치가 되지 않은듯 싶다.
옵션에 따라서 이러한 오류가 발생했다.


웃긴건, 헤더는 2.6으로 링킹은 2.4로 해도 이상이 없다는 점이다.
(뭥미?)
Posted by 구차니
컴파일 환경 자동화툴인
autoconf, automake, libtool을 설명한다.

컴파일시 각종 헤더들의 위치, 라이브러리들의위치
그리고 설치할 위치들을 설정하고,
컴파일할 프로그램의 세부 패키지를 설정한다.

아래는 ffmpeg의 configure --help 내용중 일부이다.
Standard options:
  --prefix=PREFIX         install in PREFIX          []

  --bindir=DIR            install binaries in DIR    [PREFIX/bin]
  --datadir=DIR           install data files in DIR  [PREFIX/share/ffmpeg]
  --libdir=DIR            install libs in DIR        [PREFIX/lib]
  --shlibdir=DIR          install shared libs in DIR [PREFIX/lib]
  --incdir=DIR            install includes in DIR    [PREFIX/include]
  --mandir=DIR            install man page in DIR    [PREFIX/share/man]

Advanced options (experts only):
  --enable-cross-compile   assume a cross-compiler is used
  --arch=ARCH              select architecture []
  --target-os=OS           compiler targets OS []
  --cross-prefix=PREFIX    use PREFIX for compilation tools []
  --source-path=PATH       path to source code [/home/morpheuz/st7109/target_ori/root/ffmpeg]
  --sysroot=PATH           root of cross-build tree
  --sysinclude=PATH        location of cross-build system headers
  --target-exec=CMD        command to run executables on target
  --target-path=DIR        path to view of build directory on target
  --nm=NM                  use nm tool
  --as=AS                  use assembler AS []
  --cc=CC                  use C compiler CC [gcc]
  --ld=LD                  use linker LD
  --host-cc=HOSTCC         use host C compiler HOSTCC
  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
  --host-libs=HLIBS        use libs HLIBS when linking for host
  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS []
  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
  --extra-libs=ELIBS       add ELIBS []
  --extra-version=STRING   version string suffix []
  --build-suffix=SUFFIX    library name suffix []
  --cpu=CPU                select the minimum required CPU (affects
                           instruction selection, may crash on older CPUs)
  --disable-yasm           disable use of yasm assembler
  --enable-pic             build position-independent code

이녀석의 경우 arch 와 target-os를 조합해서 cross compiler prefix를 만들어 낸다.
예를들어 sh4-linux의 경우
--enable-cross-compile --arch=sh4 --target-os=linux 라고 하면
자동으로 sh4-linux- 접두를 붙이게 된다.

하지만, target 에만 존재하는 library를 끌어 오려면 어떤 옵션을 써야 하나.. 후우..

[링크 : http://wariua.springnote.com/pages/1041972] << 한글 번역
[링크 : http://sources.redhat.com/autobook/]
Posted by 구차니
원래 목적은, 임의의 인터럽트를 소프트웨어적으로 발생시키는 건데
딱히 그에 맞는 문서를 발견하지 못했다.

그와 유사한 것은
외부 인터럽트의 경우 입력으로 설정되어 있더라도, 핀값을 설정해서 임의로 인터럽트를 발동시킬수 있다고 한다.

[링크 : http://gnc.chungbuk.ac.kr/?module=file&act=procFileDownload&file_srl=38154&sid=bdc58bb2e09e0bbfb91e3d176e68a1cf]
Posted by 구차니
x86 계열에서 메모리 팍팍 쓰면서 속도를 향상시켜준다는,
마법의(!?) JIT(Just In Time) compiler 이다.
결론은.. x86이 아니면 안되는군 ㅠ.ㅠ

 What you can do with it
     

In short: run your existing Python software much faster, with no change in your source.

Think of Psyco as a kind of just-in-time (JIT) compiler, a little bit like what exists for other languages, that emit machine code on the fly instead of interpreting your Python program step by step. The difference with the traditional approach to JIT compilers is that Psyco writes several version of the same blocks (a block is a bit of a function), which are optimized by being specialized to some kinds of variables (a "kind" can mean a type, but it is more general). The result is that your unmodified Python programs run faster.

Benefits

    2x to 100x speed-ups, typically 4x, with an unmodified Python interpreter and unmodified source code, just a dynamically loadable C extension module.

Drawbacks

    Psyco currently uses a lot of memory. It only runs on Intel 386-compatible processors (under any OS) right now. There are some subtle semantic differences (i.e. bugs) with the way Python works; they should not be apparent in most programs.

[링크 : http://psyco.sourceforge.net/]

[링크 : http://www.ibm.com/developerworks/kr/library/l-psyco.html]
Posted by 구차니