cygwin - gcc compiler installation - cygwin

I have installed cygwin on my Windows 7 platform. I now wish to access gcc. When I type man gcc, there is no gcc. When I search the downloaded folder for cygwin, I have a folder cygwin\x86_64\release\gcc and two other folders libgcc1 and libstdc++6; each folder has a tar file.
How do I install gcc please?

The instruction for the usage of cygwin setup are here:
https://cygwin.com/cygwin-ug-net/setup-net.html#setup-packages
By default the setup installs only the packages in the Base Category, that are 36
plus some libraries needed by them.
Any of the remaining ~ 8000 packages must be installed directly or could come as dependency of installed packages.
The package that contains the gcc compiler can be found with cygcheck
$ cygcheck -p bin/gcc.exe
Found 6 matches for bin/gcc.exe
gcc-core-7.3.0-1 - gcc-core: GNU Compiler Collection (C, OpenMP)
gcc-core-7.3.0-2 - gcc-core: GNU Compiler Collection (C, OpenMP)
gcc-core-7.3.0-3 - gcc-core: GNU Compiler Collection (C, OpenMP)
gcc-debuginfo-7.3.0-1 - gcc-debuginfo: Debug info for gcc
gcc-debuginfo-7.3.0-2 - gcc-debuginfo: Debug info for gcc
gcc-debuginfo-7.3.0-3 - gcc-debuginfo: Debug info for gcc
so you need to install gcc-core

Related

Buildroot: cmake can't find my compiler to build a CMake project if I install cmake on my host

Running on Ubuntu 22.04 as my host build machine.
If I install cmake with sudo apt update then sudo apt install cmake or sudo apt install catkin (since catkin includes cmake), my Buildroot build using cmake no longer can find my compiler. Why?
After running make in my buildroot project, the compiler is unknown:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache
-- Check for working C compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache"
is not able to compile a simple test program.
It fails with the following output:
...
So, uninstalling cmake from my host via sudo apt remove cmake removes this problem, but then I get a new error when I run make in my Buildroot project:
CMake Error at CMakeLists.txt:8 (find_package):
By not providing "FindTinyXML2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "TinyXML2",
but CMake did not find one.
Could not find a package configuration file provided by "TinyXML2" with any
of the following names:
TinyXML2Config.cmake
tinyxml2-config.cmake
Add the installation prefix of "TinyXML2" to CMAKE_PREFIX_PATH or set
"TinyXML2_DIR" to a directory containing one of the above files. If
"TinyXML2" provides a separate development package or SDK, be sure it has
been installed.
...but at least it can find my compiler now. Here is the output just prior to the error above, showing it now can find my gcc-11 "C compiler" and g++-11 "CXX compiler":
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/gabriel/dev/repos/my_repo/output/my_board/build/host-rospack-2.6.2/devel
-- Using CMAKE_PREFIX_PATH: /home/gabriel/dev/repos/my_repo/output/my_board/host//opt/ros/indigo/;/home/gabriel/dev/repos/my_repo/output/my_board/host/usr
-- This workspace overlays: /home/gabriel/dev/repos/my_repo/output/my_board/host//opt/ros/indigo/
-- Found PythonInterp: /home/gabriel/dev/repos/my_repo/output/my_board/host/usr/bin/python (found version "3.8.2")
-- Using PYTHON_EXECUTABLE: /home/gabriel/dev/repos/my_repo/output/my_board/host/usr/bin/python
-- Using default Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/gabriel/dev/repos/my_repo/output/my_board/build/host-rospack-2.6.2/test_results
-- Found gtest: gtests will be built
CMake Warning at /home/gabriel/dev/repos/my_repo/output/my_board/host/opt/ros/indigo/share/catkin/cmake/test/nosetests.cmake:96 (message):
nosetests not found, Python tests can not be run (try installing package
'python3-nose')
Call Stack (most recent call first):
/home/gabriel/dev/repos/my_repo/output/my_board/host/opt/ros/indigo/share/catkin/cmake/all.cmake:147 (include)
/home/gabriel/dev/repos/my_repo/output/my_board/host/opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:4 (find_package)
-- catkin 0.6.19
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: filesystem program_options system
-- Found PythonLibs: /home/gabriel/dev/repos/my_repo/output/my_board/host/usr/lib/libpython3.8.so (found suitable version "3.8.2", minimum required is "3.8")
What's going on here? I expect it to find my compiler in both cases, but it won't if I have cmake locally installed, and I expect it to find the tinyxml2 package, but it won't, even though tinyxml2 is locally installed, as I explain here.
ros-cmake-modules contains FindTinyXML2.cmake and FindTinyXML.cmake modules. Have you installed the ros-cmake-modules package with sudo apt install ros-cmake-modules ?
Your CMAKE_PREFIX_PATH is /home/gabriel/dev/repos/my_repo/output/my_board/host//opt/ros/indigo/ and the operating system of your host build machine is Ubuntu 22.04. Ubuntu version and ROS version are co-dependent, so you have to choose a pair. ROS Noetic is the version of ROS that is compatible with Ubuntu 22.04.
You might be able to get ROS Indigo to work in Ubuntu 18.04 if you install it from source, but you'll most likely run into issues. This is because ROS distros target a specific Ubuntu version (or sometimes 2 versions). If you use a different Ubuntu version, most dependencies will have different versions as well and this will most likely lead to annoying issues. For Ubuntu 18.04, you're better off running ROS Melodic. source
In a comment to this answer you wrote that your current build system is on Ubuntu 18.04 which is going to be end of life in April, so you're moving to Ubuntu 22.04. ROS Noetic is the version of ROS that is compatible with Ubuntu 22.04 or alternatively you can install ROS 2 Humble on Ubuntu 22.04 instead of Noetic by following the instructions at Ubuntu (Debian) ROS 2 Documentation: Humble documentation.

FreeBSD 12.2 i386 libs on an amd64 System

I installed FreeBSD 12.2 on my server with an amd64 kernel. I tried to compile my source which was created for an i386 system. And I get this error:
skipping incompatible /usr/local/lib/gcc9/gcc/x86_64-portbld-freebsd12.3/9.5.0/../../../libstdc++.a when searching for -lstdc++
I thought its beacuse I need the shared i386 lib libaries and I was searching how to install them. Just have found to install it over "bsdinstall" which doesnt work on my root or to unpack a .tgz file which isnt in my system either.
1.You have to check if your package (lang/gcc9) was compiled with the option multilib=ON using pkg info gcc9 and see in the Options section. If not, you have to do this from the ports tree /usr/ports/lang/gcc9 :
$ sudo make config
(set 'Multilib' option to ON)
$ sudo make
$ sudo make install clean
or as root (one shot, as you wish ...):
# make config install clean
FYI, FreeBSD has 32bits support by default, see /usr/lib32 and do not forget to check if you include this directory when building your project.
Some infos:
on the package : FreshPorts - lang/gcc9
How to Install Applications: Chapter 4 - Installing Applications Packages and Ports
Plz Check/read these docs before proceeding.
2.If you have installed/compiled gcc9 with multilib option set to ON, troubles come from your environment (IDE, missing paths from the compiler options, etc...).
EDIT: just checking my own compiler, I forgot to mention gcc/g++ could report whether it was compiled with multilib support or not, using the preproc builtins information (see --enable-multilib below), you could use the following eg:
$ g++ -m32 -E -P -v -dD
Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-portbld-freebsd13.0
Configured with: /wrkdirs/usr/ports/lang/gcc11/work/gcc-11.3.0/configure --enable-multilib --with-build-config=bootstrap-lto-noplugin --disable-nls --enable-gnu-indirect-function --enable-host-shared --enable-plugin --libdir=/usr/local/lib/gcc11 --libexecdir=/usr/local/libexec/gcc11 --program-suffix=11 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc11/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --without-zstd --enable-languages=c,c++,objc,fortran,jit --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/share/info/gcc11 --build=x86_64-portbld-freebsd13.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.3.0 (FreeBSD Ports Collection)

How to fix error: Cygwin gcc cannot be used with --compiler=mingw32

I'm trying to install this project: https://github.com/drufat/triangle. Unfortunatly, I get the following error:
error: Cygwin gcc cannot be used with --compiler=mingw32
I'm using the lastest version of gcc for Cygwin on Windows 7 64 bit and I'm trying to install that project for python 3.7.1. It's seems to come from my distutil configuration. My distutils.cfg file contains:
[build]
compiler=mingw32
I tried that solution but it doens't helped:
https://stackoverflow.com/a/16740123/5075502
The gcc options to build for MinGW64 is no longer supported by the regular cygqin compiler gcc, aka x86_64-pc-cygwin-gcc. Instead, you should also install the mingw64-x86_64-gcc-core package which provides the GCC for Win64 toolchain (C, OpenMP). This will also install other packages (through dependencies) which provide compatible binutils, headers, libraries, and runtime.
In your Makefile or compiler command line, replace gcc with x86_64-w64-mingw32-gcc. This will allow you to compile and link executables which do not depend on the cygwin1.dll.
A similar problem occured. I fixed it by changing mingw32 by gcc like #phd said.

Finding gcc location

I am on a cluster and do not have root permission, I am new to linux. I wish to run a tool with a gcc 5 version or less. My default gcc version is 6.3.0. But there is another version of gcc (gcc 4:6.3.0-4) on the system. I am trying to find its location so that I can set CC and CXX variable value to that location (e.g. export CC="/usr/bin/gcc"). I tried which gcc (it is pointing to my default gcc location) and whereis gcc. I am not able to find the location of other gcc. It would be really helpful if someone can share the way to do it.
dpkg --list | grep compiler
Name Version Architecture Description
gcc 4:6.3.0-4 amd64 GNU C compiler
gcc-6 6.3.0-18+deb9u1 amd64 GNU C compiler
My system description is as follows:
Linux b03 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
Running dpkg -L gcc 4:6.3.0-4 will give you a list of all files installed by that package. You should be able to find the executable path in there.

Header files are not found by GCC

Working with embedded C-projects. There are libraries, include files and so on - for micro controllers. No need for me to use GCC for a host machine and OS (Linux Mint 64 bit). As a rule...
But now I'm trying to compile mspdebug project from a Github - with a GCC of course. And I get an error at the very begin of make:
mspdebug$ make
cc -DUSE_READLINE -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Itransport -Idrivers -Iutil -Iui -DLIB_DIR=\"/usr/local/lib/\" -o util/btree.o -c util/btree.c
util/btree.c:19:20: fatal error: assert.h: No such file or directory
#include <assert.h>
^
compilation terminated.
I search for the includes in all possible paths (I've got the list of them via gcc -v command) - there are no assert.h file, as well, as stdio.h and so on. Except virtual box directories there is only one place (where GCC does not search includes): /usr/lib/syslinux/com32/include
AFAIK, all standard libs and includes are installed with the GCC. So I try to reinstall GCC (4.8.4) - nothing changes.
What is the normal way to give GCC all standard environment it needs?
Thanks to the right direction set by Sam Varshavchik I found the info in the stackoverflow. So I did the following:
1) installed build-essential:
sudo apt-get install build-essential
2) installed libusb (since my try to build the package revealed the absence of usb.h):
sudo apt-get install libusb-dev
And it is OK! The mspdebug (v.023) is compiled and successfully tested!
So, Linux Mint 17.2 (at least) requires installing some libs to a GCC, the most basic is build-essential.
assert.h is not part of gcc, it's a part of glibc.
Most likely, your Linux distribution puts the system headers into a separate package that you need to install.
Fedora, for examples, puts the header files in the glibc-headers package. However, you can't be using Fedora, because Fedora's gcc package has a dependency on glibc-headers, to make sure that it gets pulled in.
Whatever Linux distribution you're using, you need to research which distribution package will install the system header files you need to build stuff with.

Resources