
运行下面的命令;
$ ll /usr/lib/libfastcommon.so -rwxr-xr-x 1 root wheel 250604 11 27 21:35 /usr/lib/libfastcommon.so* $ ll /usr/lib64/libfastcommon.so -rwxr-xr-x 1 root wheel 250604 11 27 21:35 /usr/lib64/libfastcommon.so* $ gcc -L/usr/lib64 -lfastcommon Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) $ gcc -L/usr/lib -lfastcommon ld: library not found for -lfastcommon clang: error: linker command failed with exit code 1 (use -v to see invocation) 问题是,为什么明明存在 /usr/lib/libfastcommon.so 文件, gcc -L/usr/lib -lfastcommon 确报错??
环境:
$ uname -a Darwin gfdeMacBook-Air.local 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64 $ gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1 Apple LLVM version 7.0.0 (clang-700.1.76) Target: x86_64-apple-darwin15.0.0 Thread model: posix 1 zts1993 2015-11-27 23:37:32 +08:00 so 是 32 位,, gcc 64 位默认找 64 位。。我也不太懂。。 |
2 proudzhu 2015-11-28 08:22:37 +08:00 via Android 因为 /usr/lib 是个软链接?不是提示用 -v 查看错误的吗? |
3 nareix 2015-11-28 09:25:56 +08:00 能 diff 下 /usr/lib/libfastcommon.so /usr/lib64/libfastcommon.so 吗 |
4 kiwi95 2015-11-28 12:34:06 +08:00 .so 在 /lib64 下做一个软连接试试,之前遇到过类似的问题 |
5 palfortime 2015-11-28 12:42:22 +08:00 via Android gcc -L/usr/lib64 -lfastcommon 这行命令的输出说了没有 main 入口, gcc 是要编出一个可执行的文件。 |