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

$ 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.

Related

Mac clang installation seems to override GCC install

Mac 10.13.6 High Sierra here. New to C development and I'm trying to get myself setup with the latest stable/recommended GCC version, which I believe (keep me honest here) is 10.2.
When I go to the terminal to see what I have installed:
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ gcc -dumpversion
4.2.1
OK...surprised to see LLVM/clang-related stuff in the output. So I try this:
$ clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
So its almost as if... I have both clang and gcc installed, but my clang installation has assimilated my GCC installation?! Why else would the gcc --version output reference clang?
Is this typical for Mac setups?
What do I need to do to get GCC 10.2 properly installed on my machine?
Here are some simple truths, statements and observations to try and explain what's going on:
Apple ships the clang/LLVM compiler with macOS. Clang is a "front-end" that can parse C, C++ and Objective-C down to something that LLVM (referred to as a "back-end") can compile
Clang/LLVM is located in /Applications/Xcode.app/somewhere
Apple also ships a /usr/bin/gcc which just runs clang. I have no idea why they do that - it doesn't seem very helpful to me - but they don't answer my questions
Apple puts its binaries (programs) in /usr/bin. That is an integral part of macOS and you should never touch or change anything in there - you are asking for problems if you do. This warning applies to Python too.
If you want the real, lovely GNU Compiler Collection (GCC) which includes the gcc, g++ and gfortran compilers, your best bet, IMHO, is to get them from homebrew. I will not put the installation instructions here because they could become outdated, so you should use the ones on the homebrew site.
Once you have homebrew installed, you can install the GNU Compiler Collection (GCC) with:
brew install gcc
After that, you will have all the lovely GNU Compiler Collection (GCC) of tools in /usr/local/bin, so you should put that in your PATH, near the beginning, and in any case before /usr/bin, using:
export PATH=/usr/local/bin:$PATH
In general, you should also add a similar line into your login profile, or into the system login profile, so it is set up every time you or any other user logs in.
Let's take a look:
ls /usr/local/bin/gcc* /usr/local/bin/g++*
/usr/local/bin/gcc-10
/usr/local/bin/g++-10
Depending on the versions and updates, you will then have these programs available:
gcc-10 # the real GNU C compiler
g++-10 # the real GNU C++compiler
gfortran # GNU fortran compiler
And you can check their versions with:
gcc-10 -v
g++-10 -v
gfortran -v
Now you know about homebrew, here are some more simple truths and observations:
folks (who are not the supplier of the operating system) who supply binaries (programs) for you should put their stuff in /usr/local to show that it is just a locally installed program rather than a part of the core macOS operating system
homebrew is well-behaved and installs its binaries (programs) in /usr/local/Cellar and then usually makes symbolic links from /usr/local/bin/PROGRAM to the Cellar. None of this interferes with Apple-supplied stuff.
if you want to run the homebrew version of a command, you should have /usr/local/bin first on your PATH
Let's have a look at those symbolic links:
ls -l /usr/local/bin/g*10
lrwxr-xr-x 1 mark admin 31 21 Aug 16:41 /usr/local/bin/g++-10 -> ../Cellar/gcc/10.2.0/bin/g++-10
lrwxr-xr-x 1 mark admin 31 21 Aug 16:41 /usr/local/bin/gcc-10 -> ../Cellar/gcc/10.2.0/bin/gcc-10
If you want to know what you are actually running when you enter a command, use the type command like this.
type gcc
gcc is hashed (/usr/bin/gcc)
That tells you that if you run gcc you will actually be running /usr/bin/gcc which we know is from Apple - because it is in /usr/bin
Now try this:
type gcc-10
gcc-10 is hashed (/usr/local/bin/gcc-10)
That tells you that if you run gcc-10 you will actually be running /usr/local/bin/gcc-10 which we know is from homebrew - because it is in /usr/local/bin

gcc -print-multi-os-directory error on mac

My mac version is Sierra. Xcode 8.0
gcc info
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
I think gcc is not problem. My project build option is -print-multi-os-directory. but my gcc unsupported... what's the problem???
thanks
on mac your GCC is Clang as you may see in output
in clang option -print-multi-os-directory is unsupported
On current trunk (line 2079)
Was marked as unsupported here
You may try to install pure gcc via brew install gcc command
Also why do you need this option? Do you have any special checks in you project ?(this option just print path )
Since you are trying to build binutils:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/configure;h=97693870c462d5e5231bd2b512a76b7c271b9133;hb=7fa393306ed8b93019d225548474c0540b8928f7#l10348
Try to figure out why you get in condition when multi-os option is used.
This happened because your compiler passed test:

gcc -v Segmentation fault:11

I have XCode installed (Version 7.2.1 (7C1002)) in Yosemite and have downloaded and installed command line tools. When I try to check the gcc version I get:
$ gcc -v
Segmentation fault: 11
$
The output for:
$ type -a gcc
gcc is /usr/local/bin/gcc
gcc is /usr/bin/gcc
$
From what I understand, that should mean that I have it installed so I still don't understand why I can't check it's version. Since I will need gcc for other applications I would like to have it fixed...any suggestions? Do I need to link it somehow?
You have a faulty third-party version of gcc (or perhaps another compiler masquerading as gcc) installed in /usr/local. This may be something put there by Homebrew or maybe you installed this build of gcc yourself or something.
A short-term fix would be to modify your PATH environment variable so that /usr/bin comes before /usr/local/bin. Or, you could just always specify the full path to gcc, such as /usr/bin/gcc -v.
Longer term, you probably want to remove the broken gcc that's been installed to /usr/local. How you do that exactly depends on how you originally installed it there.

How to fix "No manual entry for gcc"?

I somehow lost the man pages for gcc and g++. I'm not sure where/what to look for. I'm pretty sure the man pages used to work some time ago. It also works on my Mac at work where I use roughly the same setup. Could it be a problem with brew? Or is it a bug in the XCode Command Line Tools?
Update: I just tried to re-install the XCode Command Line Tools. No luck.
~
✓ man gcc
No manual entry for gcc
~
✗ which gcc
/usr/bin/gcc
~
✓ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
gcc isn't installed anymore by Xcode, it really installs clang and calls it gcc
usxxplayegm1:~ grady$ which gcc
/usr/bin/gcc
usxxplayegm1:~ grady$ /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.0.2
Thread model: posix
you need man clang
I thought it was a symlink, but ls -l doesn't list it as a symlink, so either it is a hard link or some other sort of trickery.
This may be old and doesn't quite answers your concrete question, but I found myself in the same problem with Kali Linux and I solved it with this command, maybe is useful for someone:
apt install gcc-doc
Look at how you set MANPATH in your .profile. Instead of, e.g.,
export MANPATH=/opt/local/man:/usr/local/man
you should do
export MANPATH="/opt/local/man:/usr/local/man:$MANPATH"
And then (breathe) open a new Terminal window.
This way your .profile isn't wiping out (or reflecting an old version of) the system's way of setting MANPATH, which is modified when you install (or reinstall) Xcode.
I use High Sierra with g++ 7.2 port. Setting MANPATH environment to /opt/local/man (or to /opt/local/man/man1 where g++.gz is found) did not work. So, after ensuring that the soft link g++.gz points to g++-mp-7.1.gz (there was not a g++-mp-7.2.gz in the man1 directory though g++7.2 is my version), I always use the command:
man /opt/local/share/man/man1/g++.gz
that never fails. You can store an alias for this in your .profile, if you are frequently using the man command for g++.
For anyone who stumbles upon this currently (like I did), I found that I needed to locate my version of gcc (which I had installed with brew). This is annoying when gcc --version gives the clang version instead! To find the correct gcc version, run
$ ls /usr/local/opt/gcc/bin | grep gcc
gcc-10
gcc-ar-10
gcc-nm-10
...
So I had gcc-10. Whenever you wish to use gcc just replace it with gcc-10, e.g. man gcc-10. Of course you could write an alias for gcc to gcc-10, but this probably is not a great idea, as Xcode seems to rely on the gcc --> clang (hard?) link.

gdb debugging in Terminal OS X (10.8.5) with zsh

For my studies I have to run a binary unix-program bomb with gdb.
Some time ago I followed the steps on http://jakoblaegdsmand.com/blog/2013/04/how-to-get-an-awesome-looking-terminal-on-mac-os-x/ and made some changes to my terminal-setup.
To runbomb with gdb I typed:
-> bomb207 gdb bomb
zsh: correct 'gdb' to 'gdv' [nyae]? n
zsh: command not found: gdb
When I type 'man gdb' zsh answers 'No manual entry for gdb'
How can I change my terminal-setup to support gdb?
ps.
I already installed the command line tools for os x with x code and I didn't had any problems until now...
bomb207 is the current directory and the location of bomb.
It appears that Apple (who have been switching from gcc to clang for some time) stopped including gdb in 10.8. Even in the CommandLine tools.
The clang debugger is lldb. It is similar in use to gdb, and I'm not finding it unduly difficult to switch. Aside from explaining to my finger that they shouldn't type gdb
for the debugger anymore: my fingers don't like change.
Yes, you can still type gcc to compile things, but look:
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
on 10.15.6+ you can simply install gdb using homebrew
brew install gdb
You need to install GNU Debugger, or GDB. Try installing the full XCode package?
GDB works fine on my Mac, but then I've got full XCode installed.
Failing that, just for my peace of mind, type 'where gdb' and tell me what it prints out?
On my Mac it's in '/usr/bin/gdb', and on my linux boxes it's in '/usr/bin/gdb' and '/usr/bin/X11/gdb'.

Resources