레거시 코드를 위해 gcc를 다운그레이드해야 합니까?

레거시 코드를 위해 gcc를 다운그레이드해야 합니까?

저는 이런 레거시 시스템을 물려받았습니다.

$ uname -a
Linux pos-sthlm-globe-as-209 2.4.19-dxx #10 Thu Dec 22 15:47:12 CET 2005 i686 GNU/Linux
niklros@pos-sthlm-globe-as-209:~$ gcc --version
2.95.4

여기에는 내가 만들 수 있는 소스 코드가 있습니다(사용된 PCI 카드용 32비트 드라이버).

# make clean
test -z "mtn.o" || rm -f mtn.o
rm -rf .libs _libs
rm -f *.o core *.core
rm -f *.lo
pos-sthlm-globe-as-209:~/mtn/dxxmtn# ls
BusMastHostApi.h   bmhostif_parsed.h  proc.c        uaa.c
Makefile       cc.c           queue.c       uaa.h
Makefile.am    ct812.c        ram.c     uaa_msg.c
Makefile.in    drawbridge.c       ringbuf.c     uniporte_parsed.c
PORT           dump.c         src       uniporte_parsed.h
TODO           log.c          telem.c       untar
UniPorte.h     main.c         telem_cmd.c   usr
aaa        memring.c          telem_cons.c  vpd.c
ac         mtn            telem_misc.c
bc.c           mtn2100.rc         tmp
bmhostif_parsed.c  mtn_poll.c         tty.c
pos-sthlm-globe-as-209:~/mtn/dxxmtn# make
if [ ! -f uniporte_parsed.c -a ! -f uniporte_parsed.h ]; then \
    rm -f uniporte_parsed.c uniporte_parsed.h; \
    ../utils/grabenum.pl /usr/local/dxx/include/UniPorte.h -header > uniporte_parsed.c; \
    for enum in uniporte_managed_object_indices uniport_disconnect_reason_enumeration uniporte_port_state_enumeration ; do \
        echo "Grabbing enumerator $enum from /usr/local/dxx/include/UniPorte.h into uniporte_parsed.c..."; \
        ../utils/grabenum.pl /usr/local/dxx/include/UniPorte.h $enum -array >> uniporte_parsed.c; \
        echo "extern char *$enum[];" >> uniporte_parsed.h; \
    ...
/usr/src/linux/include/linux/sched.h:770: warning: called from here
/bin/sh ../libtool --mode=link gcc  -O -D__KERNEL__ -DMODULE -DMODVERSIONS -Wall -Winline        -o mtn.o -r uniporte_parsed.o bmhostif_parsed.o uaa.o uaa_msg.o main.o bc.o cc.o mtn_poll.o tty.o ram.o vpd.o drawbridge.o ct812.o dump.o telem.o telem_cmd.o telem_misc.o queue.o ringbuf.o telem_cons.o log.o  
mkdir .libs
/usr/bin/ld -r -o mtn.o uniporte_parsed.o bmhostif_parsed.o uaa.o uaa_msg.o main.o bc.o cc.o mtn_poll.o tty.o ram.o vpd.o drawbridge.o ct812.o dump.o telem.o telem_cmd.o telem_misc.o queue.o ringbuf.o telem_cons.o log.o   
pos-sthlm-globe-as-209:~/mtn/dxxmtn# ls
BusMastHostApi.h   ct812.c   proc.c        tmp
Makefile       ct812.o   queue.c       tty.c
Makefile.am    drawbridge.c  queue.o       tty.o
Makefile.in    drawbridge.o  ram.c         uaa.c
PORT           dump.c    ram.o         uaa.h
TODO           dump.o    ringbuf.c     uaa.o
UniPorte.h     log.c     ringbuf.o     uaa_msg.c
aaa        log.o     src           uaa_msg.o
ac         main.c    telem.c       uniporte_parsed.c
bc.c           main.o    telem.o       uniporte_parsed.h
bc.o           memring.c     telem_cmd.c   uniporte_parsed.o
bmhostif_parsed.c  mtn       telem_cmd.o   untar
bmhostif_parsed.h  mtn.o     telem_cons.c  usr
bmhostif_parsed.o  mtn2100.rc    telem_cons.o  vpd.c
cc.c           mtn_poll.c    telem_misc.c  vpd.o
cc.o           mtn_poll.o    telem_misc.o
pos-sthlm-globe-as-209:~/mtn/dxxmtn# 

이제 내 로컬 컴퓨터의 Virtual Box VM에서 복제하려고 하는데 실패하는 것 같습니다. gcc가 버전 2가 아니라 버전 3이기 때문인 것 같습니다.

# uname -a     
Linux debian 2.4.27-3-386 #1 Wed Dec 6 00:38:33 UTC 2006 i686 GNU/Linux
debian:/home/developer/mtn-copy/mtn-copy/mtn/dxxmtn# gcc --version
gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)
Copyright (C) 2003 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.

debian:/home/developer/mtn-copy/mtn-copy/mtn/dxxmtn# make clean
test -z "mtn.o" || rm -f mtn.o
rm -rf .libs _libs
rm -f *.o core *.core
rm -f *.lo
debian:/home/developer/mtn-copy/mtn-copy/mtn/dxxmtn# ls
aaa        gcc-2.95.3.tar  proc.c    tty.c
ac         log.c       queue.c   uaa.c
bc.c           main.c      ram.c     uaa.h
bmhostif_parsed.c  Makefile    ringbuf.c     uaa_msg.c
bmhostif_parsed.h  Makefile.am     src       UniPorte.h
BusMastHostApi.h   Makefile.in     telem.c   uniporte_parsed.c
cc.c           memring.c       telem_cmd.c   uniporte_parsed.h
ct812.c        mtn         telem_cons.c  untar
drawbridge.c       mtn2100.rc      telem_misc.c  usr
dump.c         mtn_poll.c      tmp       usr-src-linux-include
gcc-2.95.3     PORT        TODO      vpd.c
debian:/home/developer/mtn-copy/mtn-copy/mtn/dxxmtn# make
if [ ! -f uniporte_parsed.c -a ! -f uniporte_parsed.h ]; then \
  rm -f uniporte_parsed.c uniporte_parsed.h; \
 ...
/usr/src/linux/include/linux/signal.h:205: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:149: warning: called from here
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/dxx/include -I../mtnadm -I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h    -O -D__KERNEL__ -DMODULE -DMODVERSIONS -Wall -Winline         -c telem_misc.c
In file included from mtn/mtn.h:436,
         from mtn/telem_misc.h:28,
         from telem_misc.c:34:
/usr/src/linux/include/linux/malloc.h:4:2: warning: #warning linux/malloc.h is deprecated, use linux/slab.h instead.
In file included from mtn/mtn.h:443,
         from mtn/telem_misc.h:28,
         from telem_misc.c:34:
/usr/src/linux/include/asm/uaccess.h: In function `__constant_copy_from_user':
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/asm/uaccess.h:561: warning: called from here
/usr/src/linux/include/asm/siginfo.h: At top level:
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
/usr/src/linux/include/asm/siginfo.h:223: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
/usr/src/linux/include/asm/siginfo.h:226: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:149: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:161: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:193: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:205: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:149: warning: called from here
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/dxx/include -I../mtnadm -I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h    -O -D__KERNEL__ -DMODULE -DMODVERSIONS -Wall -Winline         -c queue.c
In file included from mtn/mtn.h:436,
         from mtn/queue.h:54,
         from queue.c:70:
/usr/src/linux/include/linux/malloc.h:4:2: warning: #warning linux/malloc.h is deprecated, use linux/slab.h instead.
In file included from mtn/mtn.h:443,
         from mtn/queue.h:54,
         from queue.c:70:
/usr/src/linux/include/asm/uaccess.h: In function `__constant_copy_from_user':
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/asm/uaccess.h:561: warning: called from here
queue.c: In function `mtn_data_queue_add':
/usr/src/linux/include/asm/uaccess.h:557: warning: inlining failed in call to `__constant_copy_from_user'
queue.c:367: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
queue.c:379: warning: called from here
queue.c: In function `mtn_data_queue_get':
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
queue.c:443: warning: called from here
/usr/src/linux/include/asm/siginfo.h: At top level:
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
/usr/src/linux/include/asm/siginfo.h:223: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
/usr/src/linux/include/asm/siginfo.h:226: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:149: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:161: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:193: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:205: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:149: warning: called from here
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/dxx/include -I../mtnadm -I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h    -O -D__KERNEL__ -DMODULE -DMODVERSIONS -Wall -Winline         -c ringbuf.c
ringbuf.c:43:19: errno.h: No such file or directory
In file included from ringbuf.c:45:
/usr/src/linux/include/asm/uaccess.h: In function `__constant_copy_from_user':
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/asm/uaccess.h:561: warning: called from here
In file included from mtn/mtn.h:436,
         from ringbuf.c:47:
/usr/src/linux/include/linux/malloc.h:4:2: warning: #warning linux/malloc.h is deprecated, use linux/slab.h instead.
ringbuf.c: In function `mtn_ringbuf_readline':
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:121: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:123: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:124: warning: called from here
ringbuf.c: In function `mtn_ringbuf_read':
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:151: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:153: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:154: warning: called from here
ringbuf.c: In function `mtn_ringbuf_read_to_user':
/usr/src/linux/include/asm/uaccess.h:548: warning: inlining failed in call to `__constant_copy_to_user'
ringbuf.c:181: warning: called from here
/usr/src/linux/include/asm/uaccess.h:548: warning: inlining failed in call to `__constant_copy_to_user'
ringbuf.c:185: warning: called from here
/usr/src/linux/include/asm/uaccess.h:548: warning: inlining failed in call to `__constant_copy_to_user'
ringbuf.c:185: warning: called from here
ringbuf.c: In function `mtn_ringbuf_write':
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:214: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:216: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
ringbuf.c:217: warning: called from here
ringbuf.c: In function `mtn_ringbuf_write_from_user':
/usr/src/linux/include/asm/uaccess.h:557: warning: inlining failed in call to `__constant_copy_from_user'
ringbuf.c:245: warning: called from here
/usr/src/linux/include/asm/uaccess.h:557: warning: inlining failed in call to `__constant_copy_from_user'
ringbuf.c:249: warning: called from here
/usr/src/linux/include/asm/uaccess.h:557: warning: inlining failed in call to `__constant_copy_from_user'
ringbuf.c:249: warning: called from here
/usr/src/linux/include/asm/siginfo.h: At top level:
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
/usr/src/linux/include/asm/siginfo.h:223: warning: called from here
/usr/src/linux/include/asm/string.h:222: warning: inlining failed in call to `__constant_memcpy'
/usr/src/linux/include/asm/siginfo.h:226: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:149: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:161: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:193: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:205: warning: called from here
/usr/src/linux/include/asm/string.h:457: warning: inlining failed in call to `__constant_c_and_count_memset'
/usr/src/linux/include/linux/signal.h:149: warning: called from here
make: *** [ringbuf.o] Error 1
debian:/home/developer/mtn-copy/mtn-copy/mtn/dxxmtn# 

내 결론이 정확합니까? gcc 버전의 차이로 인해 VM의 빌드가 실패합니까, 아니면 빌드가 실패하는 또 다른 이유가 있습니까?

답변1

귀하가 겪고 있는 심각한 오류는 전처리기 단계에서 발생합니다(일부 #include <errno.h>라인의 경우).

ringbuf.c:43:19: errno.h: 해당 파일이나 디렉터리가 없습니다

(다른 진단은 단지 경고일 뿐입니다. 각 진단을 이해해야 하지만 실수로 무시할 수도 있습니다. 다음과 같이 코드를 개선하는 것이 좋습니다.최근의버전걸프 협력 협의회-Wall -Wextra현재 통화는GCC 72017년 7월)

내 데비안 시스템에서는 <errno.h>헤더가 패키지 /usr/include/errno.h로 제공됩니다 libc6-dev. 이에 상응하는 것을 설치해야 합니다.

내가 댓글을 달았듯이, 당신은 할 수 있습니다일부gcc버전을 시스템에 설치하세요(최근 Debian에서는 gcc-5gcc-6& gcc-7패키지를 설치할 수 있으며 아래에서 최신 버전을 컴파일하고 빌드할 수도 있습니다 /usr/local/bin/).
하지만 <errno.h>이는 컴파일러에서 제공하는 헤더가 아니므로 다른 헤더가 설치되어 있습니다.걸프 협력 협의회 (예: 다운그레이드) 도움이 되지 않습니다.

관련 정보