I have code, that compile with gcc
gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
without errors
But in Xcode I have errors. For example:
error build: Undefined symbol: _element_from_bytes_compressed
Related
Building my project I get error:
ld: library not found for -lglfw
clang: error: linker command failed with exit code 1 (use -v to see invocation)
But I have installed glfw, via brew install glfw
brew list --versions | grep glfw
glfw 3.2.1
ls /usr/local/lib | grep glfw
libglfw.3.2.dylib
libglfw.3.dylib
libglfw.dylib
clang -v
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
MacOS : 10.14.1 (18B75)
Looks like adding export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib to ~/.bash_profile solved the problem, but I'm not sure if it's ellegant solution without side effects.
I am trying to compile simple C code on my system. I am running gcc version (4.9.2) on macOS 10.11.6.
ld: library not found for -lgcc
collect2: error: ld returned 1 exit status
I am unable to fix this issue. This problem is not letting me install any ./configure packages as well since they require gcc to work.
Even if there is a program called gcc under macOS, it is not a real gcc compiler. It is just a Clang compiler, as you can prove easily:
gcc --version
will print:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
You should be able to compile and link your program by omitting the -lgcc flag from the command line.
I know that recent Mac OS X versions don't use gcc (g++). When I type gcc or g++ the OS actually uses Clang (cc).
Now, I'm running OS X 10.8.2 with LLVM version 4.2 (clang-425.0.28), installed through XCode:
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
However, buried in the file system there's another more recent Clang version:
$ clang --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
How can I force gcc to "link" Clang 503... instead of Clang 425...?
Install Xcode, which will give you the latest available versions of both:
xcode-select --install
...
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ clang --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I am trying install freetds with brew install homebrew/versions/freetds091, but met this error:
clang: error: unsupported option '-V -isystem/usr/local/include'
this is the detail of config.log
configure:3787: clang --version >&5 Apple LLVM version 7.3.0
(clang-703.0.31) Target: x86_64-apple-darwin15.6.0 Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3798: $? = 0 configure:3787: clang -v >&5 Apple LLVM version
7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3798: $? = 0 configure:3787: clang -V >&5 clang: error:
unsupported option '-V
-isystem/usr/local/include' configure:3798: $? = 1 configure:3787: clang -qversion >&5 clang: error: unknown argument: '-qversion'
configure:3798: $? = 1 configure:3818: checking whether the C compiler
works configure:3840: clang conftest.c >&5 ld: unexpected token:
!tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
I already install xcode(version 8.0)
There is a strange doubtful point: xcode 8.0's clang version is 8.0, but brew use 7.x.
/Library/Developer/CommandLineTools/usr/bin/clang -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I solved it after I update my system to macOS Sierra.
I met a usual error—— symbol(s) not found for architecture x86_64,but for an unusual reason. I have searched for a long time and found some methods,but they didn't work.
Anyone can help me?Thanks.there are some parameter about my Mac below:
# cc -v
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
# gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
THX!!!