Can't find '/opt/local/bin/clang' - macos

Background information
I am trying to install AFL on MacOS X, and have been following the instructions on https://reverse.put.as/2017/07/10/compiling-afl-osx-llvm-mode/.
When I type $make in terminal, the following error appears.
[*] Checking for working 'llvm-config'...
[*] Checking for working '/opt/local/bin/clang'...
[-] Oops, can't find '/opt/local/bin/clang'. Make sure that it's in your $PATH (or set $CC and $CXX).
make: *** [test_deps] Error 1
I noticed that clang is located in /Library/Developer/CommandLineTools/usr/bin.
Here is the details when I type clang -v in terminal:
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Question
How do I move clang to the following directory '/opt/local/bin/clang'? Or is there any other thing I can do to fix this problem?

Related

"configure: error: C compiler cannot create executables" pecl extensions build fail on macos High Sierra

I'm building my web development IDE on Macos High Sierra 10.13.6 and following this tutorial. I'm at the step where I need to install PHP extensions (scpecially xDebug), but here is the error I get whenever I pecl any extension : checking whether the C compiler works... no
The whole log :
pecl install xdebug
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading xdebug-2.7.0.tgz ...
Starting to download xdebug-2.7.0.tgz (230,326 bytes)
.................................................done: 230,326 bytes
69 source files, building
running: phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
building in /private/tmp/pear/temp/pear-build-fredericsBTF0Y/xdebug-2.7.0
running: /private/tmp/pear/temp/xdebug/configure --with-php-config=/Applications/MAMP/bin/php/php7.0.15/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking whether the C compiler works... no
configure: error: in `/private/tmp/pear/temp/pear-build-fredericsBTF0Y/xdebug-2.7.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: `/private/tmp/pear/temp/xdebug/configure --with-php-config=/Applications/MAMP/bin/php/php7.0.15/bin/php-config' failed
I read everywhere to check command that line tools are installed, indeed they are (I even deleted them and reinstalled them). Now I have Xcode Version 10.1 and : xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Gcc works outside of pecl :
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
which gcc
/usr/bin/gcc
However, here is something strange: Clang installed directory is in my python Conda manager !!
clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Users/frederic/miniconda3/bin
which clang
/Users/frederic/miniconda3/bin/clang
Although, when I check via Xcode :
xcodebuild -find gcc
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc
xcodebuild -find clang
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Can miniconda cause trouble with his own clang ? Or is it something else ?
Thanks

Xcode10 & openframework IOSno

I just update to xCode10 – xCode 9 wasn't returning this error.
Whenever I try to build using openframeworks ios 10.0.0 I receive this error
/clang:-1: linker command failed with exit code 1 (use -v to see invocation)
but calling clang on my terminal I receive this
❯ clang --version
Apple LLVM version 10.0.0 (clang-1000.10.44.2) .
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Any idea on how to fix this?
I just encountered a similar issue with building in xCode 10 as well. Following the steps (both removing the flags for quicktime and in my case removing references to the i386 architecture build settings) here fixed it for me: https://forum.openframeworks.cc/t/xcode-10-0-build-errors/30447
Hope this helps!

How to use clang to create a windows binary

I have installed clang on my Windows 10 machine.
$ clang --version
clang version 6.0.1 (tags/RELEASE_601/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
With it, I can compile C and C++ sources and generate object files, and use lib.exe to create libraries of them.
When it's time to link it into a binary, to my surprise, clang is creating a lib/exp output, not an executable?
Why does clang think it should be creating a library, not an executable?
clang++ -oarmor XWin/main.o -lSDL2main -lpi -ldblunt -lsino -lbase -L. -L ../../src/sino -L MSWin/libs/SDL/lib ../../src/Chipmunk2D/build.release/x64/Release/chipmunk.lib MSWin/libs/OpenAL/lib/OpenAL32.lib -lSDL2 -lOpenGL32
Creating library armor.lib and object armor.exp
LINK : fatal error LNK1561: entry point must be defined
clang++.exe: error: linker command failed with exit code 1561 (use -v to see invocation)
In UNIX, clang will by default create binaries, not libraries?
Check this link -
https://metricpanda.com/rival-fortress-update-27-compiling-with-clang-on-windows
There are currently two flavors of Clang that work on Windows: vanilla LLVM Clang and Clang/C2 with Microsoft Codegen.

"make dependencies" on Mac gives --> "make: lsb_release: Command not found" error

$ make dependencies
in my terminal on Mac gives
make: lsb_release: Command not found
Here is the full message:
make: lsb_release: Command not found
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
/bin/bash: md5sum: command not found
mldb/ext/tinyxml2//tinyxml2.mk:1: *** hash_command1 didnt set variable g++_-fPIC_-m64_-fno-omit-frame-pointer_-msse3_-msse4.2_-Imldb_-Wall_-Werror_-Wno-sign-compare_-Woverloaded-virtual_-Wno-deprecated-declarations_-Wno-deprecated_-Winit-self_-Wno-unused-but-set-variable_-Wno-psabi_-Wno-unknown-pragmas_-pipe_-ggdb_-std_c++0x_-D_GLIBCXX_USE_NANOSLEEP_1_-D_GLIBCXX_USE_SCHED_YIELD_1_-fno-builtin-malloc_-fno-builtin-calloc_-fno-builtin-realloc_-fno-builtin-free_-o_build/x86_64/obj/mldb/ext/tinyxml2/tinyxml2.cpp.lo_-c_./mldb/ext/tinyxml2/tinyxml2.cpp_-MP_-MMD_-MF_build/x86_64/obj/mldb/ext/tinyxml2/tinyxml2.cpp.d_-MQ_build/x86_64/obj/mldb/ext/tinyxml2/tinyxml2.cpp.lo_-O3_-DBOOST_DISABLE_ASSERTS_-DNDEBUG_hash. Stop.
I have GNU Make 3.81 installed. Also, I did:
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I am on a Mac OS X. It could be linked to zsh since I installed it not too long ago and I believe that all my xcode related tools worked just fine before.
Thanks for any help or indication that can point me in the right direction to fix this.
Update
c++ code that I was trying to build is for ubuntu 14
lsb_release is a command that runs on Linux only: the "LSB" stands for "Linux Standard Base" and this refers to a standard baseline set of tools and libraries that Linux distributions can elect to support.
Your makefile should not be invoking that command, since it's not portable to OS X. I'd say that whatever code you're trying to build is not ported to OS X and will only build on Linux. But since you didn't provide any other details, we can't say for sure.

GCC warning "incompatible implicit declaration of built-in function ‘printf’" under Mac OS X Snow Leopard

After a very long time away from C programming, I've decided to try and get familiar with it again. I am trying to compile a hello.c program but am having problems. Here's the code:
#include <stdio.h>
main()
{
printf("Hello\n");
}
And here's the output from gcc:
$ gcc -o hello hello.c
hello.c:1:19: error: stdio.h: No such file or directory
hello.c: In function ‘main’:
hello.c:4: warning: incompatible implicit declaration of built-in function ‘printf’
$
I am working on a Mac running Snow Leopard (10.6.8) and Xcode 3.2.6.
Here's the 'gcc -v' output:
$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
$
gcc is not able to find stdio.h which is located in /Developer/SDKs/MacOSX10.6.sdk/usr/include. Wondering about how to set an environment variable so I don't have to specify the include path on the command line. I get another error when I specify it on the command line:
$ gcc -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -o hello hello.c
ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status
$
My LD_LIBRARY_PATH environment variable is:
$ echo $LD_LIBRARY_PATH
/Developer/SDKs/MacOSX10.6.sdk/usr/lib
$
Any help is appreciated.
Thanks,
Keith
You need to re-run the Xcode installer and check the option for UNIX Development:
Without this option you can still use Xcode but you will not get /usr/include etc for gcc command-line builds.
You already have an answer for your particular problem, but I have seen this problem on OS X for a different reason, so this may be helpful to other people.
If you have tried installing a custom compiled version of GCC and it is in /usr/local/bin or you have added a PATH entry to /opt/sw or something similar, you can get this error.
Possible reasons for having the custom GCC but no headers are:
You tried to remove the custom compiled version but forgot to delete the gcc binary.
You used the wrong configure options when building the custom GCC.
You installed the header files to the wrong directory. (Very similar to the last option.)

Resources