Learn C The Hard Way에 대한 온라인 자습서를 따르려고 노력했습니다
.
그러나 valgrind를 설정 한 후 (우분투 12.04에서 valgrind 설정을 돕는 다른 링크를 따라갔습니다) c 실행 파일을 디버깅하려고하면 다음 오류가 발생합니다.
ayusman@ayusman-ubuntu:~/lcthw$ valgrind ./ex4
==1984== Memcheck, a memory error detector
==1984== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==1984== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==1984== Command: ./ex4
==1984==
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux-x86-64.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.
ayusman@ayusman-ubuntu:~/lcthw$
valgrind가 마침내 작동하도록 할 수있는 일이 있습니까?
가상 상자에 우분투 12.04가 있습니다. 내 노트북은 Windows 7 64 비트 OS입니다.
답변
(즉 제외하고 나는 기본적으로 동일한 메시지를 가지고 ld-linux-x86-64.so.2
대체되었다 ld-linux.so.2
). apt-get
libc6-dbg가 이미 종속성으로 포함되도록 Valgrind를 설치했습니다 .
나는 아직 이것을 완전히 해결하지는 못했지만, 단서는 오류 -m32
가 건물을 사용할 때의 사용과 관련이 있다는 것입니다 .
따라서 필자의 경우 문제는 32 비트 버전의 libc6-dbg (또는 일부 구성 요소)가 Ubuntu 12.04의 64 비트 설치를 빌드 할 때 부족한 것 같습니다.
해결책 (내 경우)
나를 위해 다음 명령으로 작업을 수행했습니다 …
sudo apt-get install libc6-dbg:i386
이것은 https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/881236 에서 논의됩니다.
참고 : 패키지 libc6-dbg:i386
는 시냅틱에서 또는 명령 완성을 통해 사용 가능한 옵션으로 표시되지 않지만 apt-get
어쨌든 존재합니다.
답변
좋아, 나는 그렇게 intall libc6-dbg했다
sudo apt-get install libc6-dbg
valgrind는 잘 작동하는 것 같습니다.
우분투 포럼 링크 덕분에 :
답변
-m32 모드에서 컴파일하는 것이 매우 오랜 시간 동안이 문제로 어려움을 겪었지만 엉덩이에 통증이있었습니다. 예를 들어 -lcrypto를 사용하려면 32bit에 openssl이 없어서 -m32로 컴파일 할 수 없었습니다. .
그래서 나는 비슷한 libc6-dbg : i386 설치를 조언하는 많은 유사한 게시물을 읽었습니다. 이것이 -m32의 문제를 해결했다고 생각하지만, 내가 찾고있는 것이 아닙니다. 그래서 오랜 시간이 지난 후에 https://lists.ubuntu.com/archives/foundations-bugs/2013-November/173202.html에 도달했습니다.
따라서 dpkg -l libc6 *를 실행하고 libc6-amd64가 표시되면 도움이 될 수 있습니다. 그러나주의 깊게 읽으십시오. 포인트 2, libc6-amd64 패키지를 제거한 후에는 명령을 사용할 수 없으므로 liveCD를 준비하고 지침을 따르십시오. . 데이터를 백업하기 전에 백업하는 것이 좋습니다. 실패하면 복구 할 수있는 방법이 없기 때문입니다.
그리고 지점 4에서 조심하십시오!
ln -s /lib/x86_64-linux-gnu/ld-2.17.so /lib64/ld-linux-x86-64.so.2
라이브 CD /
폴더 에 심볼릭 링크가 만들어 지므로 여기에 제안 된 명령을 작성할 수 없습니다 . 또한 lib64에 쓸 수있는 루트 권한이 있어야합니다. 그래서 나는 그것을했다 : (나는 liveCD 터미널을 통해 열린 내 valgrind 디스크에 / 폴더가 있음)
1)sudo rm ./lib64/ld-linux-x86-64.so.2 //removing old link
2)sudo ln -s /lib/x86_64-linux-gnu/ld-2.17.so ./lib64/ld-linux-x86-64.so.2
//you refer to the file on the disk with broken linux, but if you wrote just / instead of ./ you would create the link in the liveCD / folder
내가 아무것도 잊지 않았기를 바랍니다. 이것이 도움이 될 것입니다.
추신 : libc6-amd64 패키지를 제거하기 전에 심볼릭 링크를 변경할 수 있는지 궁금합니다 (전체 liveCD 항목을 무시할 것입니다).