이미 구축 한 다른 프로젝트의 일부 dylib를 필요로하는 일부 소스 코드를 컴파일 중입니다.macOS에서 dylib 경로를 사용하는 소스 컴파일 방법 Sierra from shell
이 때마다 내가 g++
이 컴파일을 찾을 수 없습니다 것을 알고
g++ some_code.cpp -I/usr/local/include -o executable_binary
을 실행 x86_64` 아키텍처를 찾을 수 없습니다 기호 (들) : 나는
LD 받고 있어요 dylibs (
/usr/local/include
에 설치됨) 오류는 dylib의 일부인 많은 특정 기호를 언급하기 때문에.나는 이미 시도했다 :
- 는 컴파일 옵션에
-L/usr/local/lib
추가install_name_tool -id "@/usr/local/lib/requiredlib.dylib" /usr/local/lib/requiredlib.dylib
- 실행.
- 모든 dylib 경로를 명시 적으로 컴파일 옵션에 추가합니다.
- 시에라가 보안상의 이유로 변수를 설정할 수 없기 때문에
DYLD_LIBRARY_PATH
을 추가하려고합니다.
DYLD_LIBRARY_PATH
을 추가 할 수는 있지만 SIP를 비활성화해야한다는 것을 알고 있습니다. 나는 이것을 할 수있는 더 깨끗한 방법이 있다면 나는 원하지 않는다.추신 : Tulip graph library에 대한 자습서 예제를 컴파일하려고합니다.
누락 된 기호는 내가 설치 한 그래프 라이브러리와 관련이 있습니다. 오류 메시지는 다음과 같습니다
Undefined symbols for architecture x86_64: "tlp::saveGraph(tlp::Graph*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, tlp::PluginProgress*)", referenced from: _main in tutorial001-02ee7e.o "operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, tlp::Graph const*)", referenced from: _main in tutorial001-02ee7e.o ld: symbol(s) not found for architecture x86_64
내가
ls /usr/local/lib/requiredlib.dylib
을 할 때마다 튤립의 모든 컴파일 된 라이브러리가있다.
g++ -v
는 생산 :Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ls /usr/local/include/tulip/
을 수행 한 후 내가 사용하려는 라이브러리의*.h
파일의 목록을 가져옵니다.
누락 된 심볼, 실행중인 g ++의 변형 등은 분명하지 않습니다. 물론 컴파일 된 라이브러리는'/ usr/local/include'에 설치되어 있지 않습니다. – pvg
질문을 편집하여 세부 정보를 추가하십시오 . – pvg
오류가있는 링키지에 대한 도움을 받으려면 적어도 링키지 명령 줄 및 그 출력 인 * 축 어적 *을 게시해야합니다. 의 스케치 보고서는 너무 모호하여 추측을 넘어 설 수 없습니다. –