프로그램 사용/gcc2009. 9. 21. 21:33
--sysroot=dir
    Use dir as the logical root directory for headers and libraries. For example, if the compiler would normally search for headers in /usr/include and libraries in /usr/lib, it will instead search dir/usr/include and dir/usr/lib.

    If you use both this option and the -isysroot option, then the --sysroot option will apply to libraries, but the -isysroot option will apply to header files.

    The GNU linker (beginning with version 2.16) has the necessary support for this option. If your linker does not support this option, the header file aspect of --sysroot will still work, but the library aspect will not.

-isysroot dir
    This option is like the --sysroot option, but applies only to header files.  See the --sysroot option for
    more information.

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

기본값은 /usr/include 인데, -sysroot로 기본 디렉토리를 변경 시키면
<stdio.h> 와 같은 파일도 찾지 못해 link 에러를 발생시키며 컴파일이 실패된다.

$ more test.c
#include <stdio.h>

int main(int argc, char **argv)
{
        printf("hello world\n");
        return 0;
}

$ gcc --sysroot=/ test.c
/usr/bin/ld: this linker was not configured to use sysroots
collect2: ld returned 1 exit status



아무튼, 크로스컴파일과 같이 특정 include 디렉토리를 사용해야 할 경우,
--sysroot 를 이용해서 변경하면 될 듯 하다
Posted by 구차니
아래 링크를 보니, target을 위한 include 들이 잘못되었을 것이라고 되어있다.
나의 경우에는 samba 크로스컴파일 중에 겪은 녀석으로(글 쓰는 시점에도 미해결 ㅠ.ㅠ)
이걸 해결한 줄 알고 있었더니, 콤보로 Error: unknown opcode 라는 녀석이 발동되었다..
왜인가 했더니.. macro 라고 되어있다. 그런이유로, asm 레벨에서 오류가 있었다고 하고
조금은 뜬금 없어 보이지만, asm 에 불가능한 문구가 있다고 에러가 나는 듯 하다.


FD_ZERO is a macro used to initialise an fd_set structure prior to using
select().  These are OS-provided, so if they won't compile then this
suggests that you're using the wrong headers for the target.

[링크 : http://www.realvnc.com/pipermail/vnc-list/2007-February/057070.html]


추적 / Trace
# grep -rn "FD_ZERO" /usr/include
/usr/include/sys/select.h:96:#define    FD_ZERO(fdsetp)         __FD_ZERO (fdsetp)

/usr/include/bits/select.h:70:#define __FD_ZERO(fdsp) \
 26 # define __FD_ZERO(fdsp) \
 27   do {                                                                        \
 28     int __d0, __d1;                                                           \
 29     __asm__ __volatile__ ("cld; rep; stosl"                                   \
 30                           : "=c" (__d0), "=D" (__d1)                          \
 31                           : "a" (0), "0" (sizeof (fd_set)                     \
 32                                           / sizeof (__fd_mask)),              \
 33                             "1" (&__FDS_BITS (fdsp)[0])                       \
 34                           : "memory");                                        \
 35   } while (0)

/usr/include/asm/posix_types.h:70:#define __FD_ZERO(fdsetp) \
 69 #undef  __FD_ZERO
 70 #define __FD_ZERO(fdsetp) \
 71 do { \
 72         int __d0, __d1; \
 73         __asm__ __volatile__("cld ; rep ; stosl" \
 74                         :"=m" (*(__kernel_fd_set *) (fdsetp)), \
 75                           "=&c" (__d0), "=&D" (__d1) \
 76                         :"a" (0), "1" (__FDSET_LONGS), \
 77                         "2" ((__kernel_fd_set *) (fdsetp)) : "memory"); \
 78 } while (0)

Posted by 구차니
아마.. 옵션 바꾸어 본다고 쑈를 하다가
make clean 안하고 하는 바람에 생긴 문제인 듯 하다.


unknown opcode는 어셈블리 수준에서 특정 명령어가 잘 못 되었다는 건데,
중간에 make 하다가 중단되어 옵션을 변경하고 clean 하지 않은채 다시 컴파일을 시도하면
이미 compile 된 녀석들은 잘못된 옵션으로 컴파일이 되면서 특정 함수를 못 찾거나
혹은 이러한 특수한 에러를 발생 시키는 듯 하다.



일단 make clean 후에
./configure 를 수행 후
make 하도록 하면 이러한 에러는 피할 수 있을 것으로 보인다.
Posted by 구차니
오프라인에서도 마지막에 서버에서 받은 것과 diff 할 수 있다!

2010.02.02 추가
(cvs에서는 온라인이 아니라면 비교해 볼수도 없다.)
2009/05/08 - [프로그램 사용/SVN/CVS] - SVN의 단점

Posted by 구차니
비슷비슷한 내용 -ㅁ-
anonymous / secure 설정에 대한 smb.conf의 예제들이 있다.

[링크 : http://us1.samba.org/samba/docs/man/Samba-HOWTO-Collection/FastStart.html]
[링크 : http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/ref-guide/s1-samba-servers.html]

2009.12.24 추가
삼바 공식 smb.conf man page
[링크 : http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html]

smb.conf 한글 번역 내용 - oops.org
[링크 : http://sec.tistory.com/entry/smbconf-%EC%84%A4%EC%A0%95]
Posted by 구차니
서버 설정후 localhost에서 접속을 시도하려고
smbclient -L localhost 하는데 에러가 발생했다.

Server requested LANMAN password (share-level security) but 'client lanman auth' is disabled

일단 찾아봐도 딱히 답은 없지만..

아마도 security = SHARE 를 선택했을 경우, smb.conf에
client lanman auth = yes
lanman auth = yes
가 빠져 있으면 생기는 에러로 생각된다.

[링크 : http://sidux.com/PNphpBB2-viewtopic-t-14163.html]
Posted by 구차니
Upgrading from Samba-3.0.x to Samba-3.2.0
Upgrading from Samba-2.x to Samba-3.0.25

요런 내용이 있다.

3.0.25 는 3.0.x 이긴 하지만, 실질적으로 Samba2에 속하고
upgrade 시에 위에 보다시피 Samba2는 3.0.25를 거쳐 3.2.0 으로 업그레이드 가능하다.

Samba-3.0.25 default behavior should be approximately the same as Samba-2.2.x
보다시피 3.0.25는 2.2.x 대와 근원적으로 비슷하지만, 일종의 다리 역활로 samba3 에 속해있는 듯 하다.

[링크 : http://us3.samba.org/samba/docs/man/Samba-HOWTO-Collection/upgrading-to-3.0.html]
Posted by 구차니
# smbd -S -F
smbd version 3.0.23c started.
Copyright Andrew Tridgell and the Samba Team 1992-2006
Unable to open printcap file /etc/printcap for read!
Unable to open printcap file /etc/printcap for read!
ERROR: Could not determine network interfaces, you must use a interfaces config line

3.2.0 에서는 이런게 없었는데..
아무튼 3.0.23c 에서는
smb.conf의 global 섹션에 interface가 있어야 한다.

[global]
    interface = eth0

[링크 : http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg223269.html]





./samba-3.0.23c/source/ 에서 아래의 명령을 실행하면 테스트 프로그램이 컴파일 된다.
gcc -g -o interfaces lib/interfaces.c -DAUTOCONF_TEST=1 -DHAVE_IFACE_IFCONF=1

[링크 : http://lists.samba.org/archive/samba-technical/2006-February/045430.html]
RE - [링크 : http://lists.samba.org/archive/samba-technical/2006-February/045440.html]
Posted by 구차니
머.. 어짜피 samba3 계열의 중간 다리를 하는 버전들이라 설치방법은 3.2.0 과 동일하다.

./samba-3.0.23c/source/ 에서
$ ./autogen.sh
$ export CC=<cross-compile-gcc>
$ ./configure --host=i686
$ make
$ make DESTDIR=<target_root_path> install

근데, 하다보면 에러난다.

Compiling lib/time.c
lib/time.c: In function `GetTimeOfDay':
lib/time.c:60: error: too few arguments to function `gettimeofday'

검색해보니, vi ./samba-3.0.23c/source/lib/time.c 의 60 라인에
gettimeofday(tval); 부분을
gettimeofday(tval,NULL);  이렇게 수정해주면된다.

  55 void GetTimeOfDay(struct timeval *tval)
  56 {
  57 #ifdef HAVE_GETTIMEOFDAY_TZ
  58         gettimeofday(tval,NULL);
  59 #else
  60         gettimeofday(tval);
  61 #endif
  62 }

이런 소스인데, HAVE_GETTIMEOFDAY_TZ 를 다른 곳에서 선언해주면 문제없이 될 듯 하다.


[링크 : http://www.nabble.com/3.0.21a-cross-compiling-%28uClibc%29-for-mipsel-fails-td2450460.html]
Posted by 구차니
한참을 잊고 있었던 것이 있는데..
삼바는 linux상에서 사용시에, user account(사용자 계정)가 리눅스 상에 존재해야 한다는 것이다.

[링크 : http://www.brennan.id.au/18-Samba.html]

# smbpasswd --help
smbpasswd: invalid option -- -
When run by root:
    smbpasswd [options] [username]
otherwise:
    smbpasswd [options]

options:
  -L                   local mode (must be first option)
  -h                   print this usage message
  -s                   use stdin for password prompt
  -c smb.conf file     Use the given path to the smb.conf file
  -D LEVEL             debug level
  -r MACHINE           remote machine
  -U USER              remote username
extra options when run by root or in local mode:
  -a                   add user
  -d                   disable user
  -e                   enable user
  -i                   interdomain trust account
  -m                   machine trust account
  -n                   set no password
  -W                   use stdin ldap admin password
  -w PASSWORD          ldap admin password
  -x                   delete user
  -R ORDER             name resolve order


/usr/local/samba/private/smbpasswd 라는 파일이 존재한다고 하는데, 버전별로 다른 듯 하다.
FC6의 삼바는 3.0.23 버전으로 smbpasswd 파일이
/etc/samba/passwd에 존재한다.

아무튼 별도로 관리하는 이유는, 해싱함수가 다르기 때문이라고 한다.
[링크 : http://coffeenix.net/doc/samba_guide/node18.html]
Posted by 구차니