No Working C Compiler Found - c++

I just downloaded it from here to try it:
http://www.videolan.org/developers/x264.html
I ran ./configure. It complained that I didn't have an assembler and suggested I ran ./configure --disable-asm. Then all seemed to compile OK.
How did you install gcc? From the repositories?
After i check the GCC version by using (gcc --version) command in terminal. The log is
i686-apple-darwin11-llvm-gcc-4.2
(GCC) 4.2.1 (Based on Apple Inc. build 5658)
(LLVM build 2336.11.00)
how can i solve this issue ..? I want to make compile and install.

Check config.log and search for "working C compiler". You will see the error that caused the test to fail.
You really need to supply more information (for example, the output of running configure). "Then all seemed to compile OK." is especially confusing. If "all seemed to compile OK", what is your problem?

it seems that you don't have required yasm,
go through below link & download.
http://www.linuxfromscratch.org/blfs/view/svn/general/yasm.html
Steps to follow :
download from above link
extract files
./configure
make
make install #
yasm --version
if it is 1.3.0 then its OK, otherwise reply me if you are not getting right version details
again try to install your software, you will definitely find right assembler

Related

How do I set path to respective bin of the mingw directory

I'm trying to use C++ in VSCode, and I found a tutorial where I install g++ and clang to make it work.
I installed g++ fine, and added it to my list of environment variables, but then the instructions for installing clang say to "set path to respective bin of the mingw directory" without showing me how.
What does this mean and how do I do that?
Also, #include <iostream> looks like it doesn't work either, it says the file is not found, so I'm wondering if it's because clang isn't installed or something else I need to fix. Thanks!
Ok, I've skimmed that tutorial video and YouTube comment section. Basically I think it's a poor tutorial, as it doesn't explain the basics, and that's why you're getting tripped up. My first recommendation is to save yourself some trouble and follow the VSCode Getting Started with C++ Tutorial instead.
Not only is the official tutorial easier to understand, it will guide you toward using the Microsoft C++ extension that almost everyone uses (and can help you with), rather than the comparatively obscure Clang-based C++ extension.
But that's not answer to your actual question. You asked:
... the instructions for installing clang say to "set path to respective bin of the mingw directory" without showing me how.
What does this mean and how do I do that?
I'm not sure! It's sort of nonsensical. But I think what is meant is:
Install mingw GCC and put its bin directory on the PATH.
Install LLVM+Clang and put its bin directory on the PATH.
Start VSCode from a shell where both are on the PATH.
Then proceed with the linked tutorial.
You say you already have mingw GCC on your path, but let's check that. At the command prompt (I assume you are using the default Windows cmd.exe shell), run:
> gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you don't see output like that, then something is wrong. Make sure the bin directory of mingw GCC, which contains gcc.exe, is on your PATH.
Next, Clang. Clang is part of LLVM. Wherever you installed LLVM, there should be a bin directory inside it containing clang.exe. Add that to your PATH. In my case, I installed LLVM into d:\opt\llvm-8.0.1, so I would run:
> set PATH=%PATH%;d:\opt\llvm-8.0.1\bin
Then check that it is working:
> clang --version
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: D:\opt\llvm-8.0.1\bin
Once both gcc --version and clang --version respond similarly to what I have shown, you're ready to start VSCode:
> code
and from there, the tutorial's instructions should work.
I faced a similar issue a while back. Go to the installation directory of mingw/bin. copy this path and add it to the environment variable PATH to your Windows system, save it. Relaunch vscode and then try pressing ctrl + ` and execute code using g++. This way gdb will also work.

OSX - replace gcc version 4.2.1 with 4.9 installed via Homebrew

This has been plaguing me for awhile now. I am trying to compile a huge C++ file (I know it works as I it works fine on my Arch Linux computer at work). When I checked my GCC version on my mac It returns the following
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
I have also installed the most recent GCC version using Homebrew with
brew install gcc49
My question now is how do I apply that newly installed GCC version to be the default version that the terminal uses?
I am also aware that when you use homebrew to isntall gcc it names it gcc-49 so that there is no confusion between packages.
I have no idea how to replace the 4.2.1 version that comes with XCode with the 4.9 version I have installed.
Thanks
Edit:
Switched to my mac to get the full return statement of gcc --version
Edit 2:
My end game here is to be able to navigate to the directory and be able to type
make
sudo make install
to install the daemon that has been made. Right now that returns tons of errors with random packages and the Standard Library
By default, homebrew places the executables (binaries) for the packages it installs into /usr/local/bin - which is a pretty sensible place for binaries installed by local users when you think about it - compared to /bin which houses standardisded binaries belonging to the core OS. So, your brew command should have installed gcc-4.9 into /usr/local/bin. The question is now how to use it... you have several options.
Option 1
If you just want to compile one or two things today and tomorrow, and then probably not use the compiler again, you may as well just invoke the gcc installed by homebrew with the full path like this:
/usr/local/bin/gcc-4.9 --version
Option 2
If you are going to be using gcc quite a lot, it gets a bit tiresome explicitly typing the full path every time, so you could put the following into your ~/.bash_profile
export PATH=/usr/local/bin:$PATH
and then start a new Terminal and it will know it needs to look in /usr/local/bin, so you will be able to get away with simply typing
gcc-4.9 --version
Option 3
If you just want to use gcc to invoke the compiler, without worrying about the actual version, you can do Option 2 above and additionally create a symbolic link like this
cd /usr/local/bin
ln -s gcc-4.9 gcc
That will allow you to run the homebrew-installed gcc by simply typing gcc at the command line, like this
gcc --version
Note:
If you later want to install, say gcc-4.13 or somesuch, you would do your brew install as before, then change the symbolic link like this:
cd /usr/local/bin
rm gcc # remove old link from gcc to gcc-4.9
ln -s gcc-4.13 gcc # make new link from gcc to gcc-4.13
Note that if you are actually using C++ rather than C, you will need to adapt the above for g++ in place of gcc.
simply updating the order of $PATH in ~/.bash_profile to the brew installed version 'export PATH=/usr/local/Cellar/gcc/5.1.0/bin:$PATH' was not enough to make the switch for me
changing the alias in your ~./bash_profile (alias gcc='gcc-5') works, but can be confusing i.e. which gcc will return the Clang version
what worked for me was to make a symbolic link in the brew gcc directory as well as update the path (point 1 above)
cd /usr/local/Cellar/gcc/5.1.0/bin/gcc
ln -s gcc-5 gcc
now which gcc returns the correct version 5.1.0
OS X does not come with GCC installed (4.2.1 or otherwise). Clang is the default system compiler and has been for some time. It is using the C++ headers from 4.2.1 when invoked as GCC. Have you tried compiling your code with Clang natively, instead of calling "gcc" (which calls Clang)? It has more modern headers and C++ support than the GCC emulation mode.
Download the gcc binaries untar and copy the bin, lib include share and libexec files to your /usr directory then type gcc --version this is what i expect you to see
gcc --version
gcc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiling a Qt5.2 project on OsX 10.9 with gcc4.2?

I have a QT project that works perfectly under my current configuration ( OsX 10.8.5, QT4.8.5 and compiler i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
The problem is I am switching to a new laptop that has OsX 10.9 installed. As known problem there is only CLang. Using CLang the project gives a lot of compilation errors on some libraries that I cannot change. (errors that are not given under the current configuration ).
Hence I have installed apple-GCC4.2.1 using brew and with gcc --version I get:
i686-apple-darwin11-llvm-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3).
Now I get "no such file or directory" for files <stdarg.h> and <float.h>, under the directory
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
For what I have understood it is like it is including the basic c++ headers from the Xcode compiler and they do not match with the ones that gcc4.2.1 wants.
Can someone help me? thank you in advance.
All of the C++ code (Qt, your application, any C++ libraries that you use) must be compiled with the same C++ compiler.
I have solved.
I have to say that the following procedure worked for my case, but I cannot be sure that this can work for you and/or if this procedure can be dangerous for your system configuration.
For me, worked this procedure.
Install command_line_tools_os_x_mavericks_for_xcode_late_october_2013
( not sure if it is necessary, but i think so )
Install Qt4.8.5 and set it up on QtCreator
install homebrew
install apple-gcc42 and gdb using brew:
brew tap homebrew/dupes
brew install apple-gcc42
brew install gdb
set up the compiler and GDB on QtCreator and then create your kit.
codesign gdb following this guide (scroll until you find
"Generate Certificate for signing".
have fun.
in my case it was necessary to modify the makefile in order to set for
CFLAGS, CXXFLAGS and LFLAGS the value -mmacosx-version-min=10.6.

Cygwin 64 G++ -fuse-linker-plugin Error

I am receiving the following error when I try to compile a very basic C++ program.
$ g++ -fuse-linker-plugin test.cpp
g++: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.
Code
int main() {
return 0;
}
This is using G++ installed straight out of a fresh Cygwin installation.
If I search for the file there, it does exist and is located at:
/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/cyglto_plugin.dll
How do I make Cygwin 64 look at this correctly?
I guess you only checked the gcc-g++ package at installation. Note that the version is 4.8.1-3 BUT on the next page you can see a lot of dependencies being installed, for example libgcc with version 4.8.2.
That mix of 4.8.1 and 4.8.2 seems to be the problem.
In the installer, copy all dependencies into an editor, search for 4.8.2 to find the problematic packages, go back in the installer and click those packages until 4.8.1-3 will be installed.
Double check you're not installing the latest version of those packages.
More recently using apt-cyg, g++ 4.9.2 was installed but gcc-core 4.8.2 remained.
Resolved by:
apt-cyg remove gcc-g++
apt-cyg remove gcc-core
apt-cyg install gcc-g++
Two version of gcc was causing proble, check folder /usr/libexec/gcc/x86_64-pc-cygwin/ there would be two version of gcc.
To solve remove one.
The above answer worked for me, but I got caught by the installer automatically upgrading packages back to 4.8.2. So, I initially thought this didn't work; it actually did. You just need to be aware of that when using the installer to add packages later, it may try to upgrade back to 4.8.2 again and break things.
There is the option to turn off LTO with -fno-use-linker-plugin, but that doesn't do me any good becuase CPAN is what is launching g++. It might serve as a workaround.
(I know this isn't much of an answer, but I was unable to comment)

How do I install g++ on MacOS X?

I want to compile C++ code on MacOS X, using the g++ compiler. How do I install it?
That's the compiler that comes with Apple's XCode tools package. They've hacked on it a little, but basically it's just g++.
You can download XCode for free (well, mostly, you do have to sign up to become an ADC member, but that's free too) here: http://developer.apple.com/technology/xcode.html
Edit 2013-01-25: This answer was correct in 2010. It needs an update.
While XCode tools still has a command-line C++ compiler, In recent versions of OS X (I think 10.7 and later) have switched to clang/llvm (mostly because Apple wants all the benefits of Open Source without having to contribute back and clang is BSD licensed). Secondly, I think all you have to do to install XCode is to download it from the App store. I'm pretty sure it's free there.
So, in order to get g++ you'll have to use something like homebrew (seemingly the current way to install Open Source software on the Mac (though homebrew has a lot of caveats surrounding installing gcc using it)), fink (basically Debian's apt system for OS X/Darwin), or MacPorts (Basically, OpenBSDs ports system for OS X/Darwin) to get it.
Fink definitely has the right packages. On 2016-12-26, it had gcc 5 and gcc 6 packages.
I'm less familiar with how MacPorts works, though some initial cursory investigation indicates they have the relevant packages as well.
Installing XCode requires:
Enrolling on the Apple website (not fun)
Downloading a 4.7G installer
To install g++ *WITHOUT* having to download the MASSIVE 4.7G xCode install, try this package:
https://github.com/kennethreitz/osx-gcc-installer
The DMG files linked on that page are ~270M and much quicker to install. This was perfect for me, getting homebrew up and running with a minimum of hassle.
The github project itself is basically a script that repackages just the critical chunks of xCode for distribution. In order to run that script and build the DMG files, you'd need to already have an XCode install, which would kind of defeat the point, so the pre-built DMG files are hosted on the project page.
Type g++(or make) on terminal.
This will prompt for you to install the developer tools, if they are missing.
Also the size will be very less when compared to xcode
Download Xcode, which is free with an ADC online membership (also free):
http://developer.apple.com/technology/xcode.html
xcode is now available for free from the app store. Just "buy it" (for free) and it will download. To get the command line tools go into preferences/downloads and "install command line compiler tools".
Instead of gcc you are using clang, but it works the same.
Here is how to do it on the newer mac chips and how to switch from clang(default) to g++
Install g++ through home-brew.
Check out the version you just installed, probably 12th or higher
You can make a symbolic link from g++-12 to g++
In order to do it, just type in your terminal:
sudo ln -s $(which g++-12) /usr/local/bin/g++.
Now open a new terminal and check your version again and you should see g++ instead of clang
g++ --version