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)
Related
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
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.
Last days I've been trying to compile a STM32F4xx project with Ubuntu 14.04LTS, Eclipse and GNU ARM plugin for Eclipse. Now it says that nano.specs is missing.
Here is my build log:
14:39:35 **** Incremental Build of configuration Release for project F4Test ****
make all
Building target: F4Test.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -Wextra -g -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"F4Test.map" --specs=nano.specs -o "F4Test.elf" ./system/src/stm32f4-hal/stm32f4xx_hal.o ./system/src/stm32f4-hal/stm32f4xx_hal_cortex.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash_ramfunc.o ./system/src/stm32f4-hal/stm32f4xx_hal_gpio.o ./system/src/stm32f4-hal/stm32f4xx_hal_iwdg.o ./system/src/stm32f4-hal/stm32f4xx_hal_pcd_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_pwr.o ./system/src/stm32f4-hal/stm32f4xx_hal_pwr_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_rcc.o ./system/src/stm32f4-hal/stm32f4xx_hal_rcc_ex.o ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/_write.o ./system/src/newlib/assert.o ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o ./system/src/cmsis/system_stm32f4xx.o ./system/src/cmsis/vectors_stm32f4xx.o ./src/BlinkLed.o ./src/Timer.o ./src/_initialize_hardware.o ./src/main.o
arm-none-eabi-g++: error: nano.specs: No such file or directory
make: *** [F4Test.elf] Error 1
14:39:35 Build Finished (took 65ms)
I found some nano.specs files on my computer. What should I do? Just remove linker flag (I can't actually do that, because I can't figure out how to do that in Eclipse) or something else?
Thanks for your help!
I solved the problem. I was just using arm-none-eabi-xxx packages provided by Ubuntu, not original ones - that was the problem. All you need to do is simply download packages from toolchain's website and install them. They work just fine!
Optional step
If you have installed the bundled toolchain from Ubuntu's repositories - get rid of them:
$ sudo apt-get remove gcc-arm-none-eabi
Recommended way to install
This is described on the plugin's page:
http://gnuarmeclipse.github.io/toolchain/install/
-> with an exact description what packages are needed for your specific edition (14.04 LTS, x64 in this case).
First, install 32-bit dependency libraries:
$ sudo apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0
(15.04 - and later? - need just lib32ncurses5, while older Ubuntus - 12.04 e.a. - have ia32-libs).
Then download a pre-compiled toolchain package from here:
https://launchpad.net/gcc-arm-embedded/+download
(they recommend gcc 4.9 at the time of writing, but it should be OK to take the newest, gcc 5.3 version).
Recommended install location
Finally untar the package into /usr/local - this way the Eclipse plugin should find it, without configuring toolchains in Eclipse preferences or modifying $PATH variable.
$ cd /usr/local
$ sudo tar xf ~/Downloads/gcc-arm-none-eabi-*-linux.tar.bz2
If you are compiling for ARM Cortex-M or Cortex-R, try installing the package gcc-arm-embedded with apt-get instead of gcc-arm-none-eabi. This worked for me, and the suggestion came from the documentation for Arm's "Yotta" build tool: http://yottadocs.mbed.com/#linux-cross-compile.
I am trying to debug gcov code. I wrote a simple C program which calls __gcov_flush() method which is part of gcc/gcov.
After confirming that libgcov.a library has not been built with debug symbols, I have installed debuginfo packages for gcc on my machine (SLES 10).
# gcc -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix= --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=x86_64-suse-linux
Thread model: posix
gcc version 4.1.2 20070115 (SUSE Linux)
# rpm -qi gcc-debuginfo-4.1.2_20070115-0.29.6.x86_64
Name : gcc-debuginfo Relocations: (not relocatable)
Version : 4.1.2_20070115 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 0.29.6 Build Date: Sat Sep 5 03:04:50 2009
Install Date: Thu Apr 24 05:25:32 2014 Build Host: bingen
Group : Development/Debug Source RPM: gcc-4.1.2_20070115-0.29.6.src.rpm
Size : 251823743 License: GPL v2 or later
Signature : DSA/SHA1, Sat Sep 5 03:06:59 2009, Key ID a84edae89c800aca
Packager : http://bugs.opensuse.org
URL : http://gcc.gnu.org/
Summary : Debug information for package gcc
Description :
This package provides debug information for package gcc.
Debug information is useful when developing applications that use this
package or when debugging this package.
Distribution: SUSE Linux Enterprise 10
/usr/lib/debug/usr/bin # ls -lrt gcov.debug
-rw-r--r-- 1 root root 94216 Sep 5 2009 gcov.debug
However, even after installing the proper version of debuginfo (gcov.debug) packages, GDB still cannot recognize the line number information, it just passes the control to next line without reporting line number (or stepping into the function).
(gdb)s
26 i++;
(gdb)s
27 __gcov_flush();
(gdb)s
28 printf("%d",i);
(gdb)
(gdb) show debug-file-directory
The directory where separate debug symbols are searched for is "/usr/lib/debug".
Why GDB cannot identify line number information for gcov? If I have not installed the proper version of debuginfo packages for gcc/gcov, How to confirm it?
After confirming that libgcov.a library has not been built with debug symbols, I have installed debuginfo packages
You don't appear to understand how debuginfo packages work. They can't magically add debuginfo to an archive library that was built without debug symbols (or one that was stripped).
The usual build flow is:
build everything with -g
prepare separate debuginfo packages for all fully-linked binaries (executables and shared libraries)
strip fully-linked binaries (but not archive libraries)
This allows binaries and shared libraries to be small, but still debuggable after installing the debuginfo package.
Apparently, on SLES10 the "but not archive libraries" was not honored, and libgcov.a got stripped as well. Since separate debuginfo packages do not work for archive libraries, you can't get that info back. Your only option is to rebuild GCC from sources.
P.S. Why would they strip libgcov.a?
It's a trade-off: binaries that end-users link will be smaller, but code in libgcov.a will not be debuggable.
Since most end-users never debug libgcov.a, I'd say it was not an unreasonable trade-off.
I'm trying to configure GCC 4.7.2, but it's failing with configure: error: Unable to find a usable PPL
I've looked in GCC prerequisites page and PPL isn't mentioned anywhere.
I'm using CLooG 0.17.0, which uses ISL, and as such no longer requires PPL (as far as I can tell)
Is there some other requirement on PPL in GCC which means I still need PPL, or am I missing some flag from my configure line?
I am passing the following options to configure:
--enable-cloog-backend=isl
--with-cloog=$PREFIX
--with-isl=$PREFIX
--with-gmp=$PREFIX
--with-mpfr=$PREFIX
--with-mpc=$PREFIX
For completeness, my full configure line is as follows:
./configure --prefix=/hostname/tmp/syddev/sdk/gcc472/suse11/x86_64 \
--disable-multilib --enable-cloog-backend=isl \
--with-mpc=/hostname/tmp/syddev/sdk/gcc472/suse11/x86_64 \
--with-mpfr=/hostname/tmp/syddev/sdk/gcc472/suse11/x86_64 \
--with-gmp=/hostname/tmp/syddev/sdk/gcc472/suse11/x86_64 \
--with-isl=/hostname/tmp/syddev/sdk/gcc472/suse11/x86_64 \
--with-cloog=/hostname/tmp/syddev/sdk/gcc472/suse11/x86_64 \
--build=x86_64-suse-linux --with-pkgversion='SIG build 11/27/2012' \
--with-gxx-include-dir=/hostname/tmp/syddev/sdk/gcc472/suse11/x86_64/include/c++/4.7.2 \
--enable-version-specific-runtime-libs
Update:
In order to try make forward progress I decided to add PPL to my installation list, and add --with-ppl=$PREFIX to my configure line.
Configure still fails with configure: error: Unable to find a usable PPL
It seems this is a bug in the configure script: Configure fails if PPL_MINOR_VERSION < 11
With the latest version PPL_MINOR_VERSION=0 (and PPL_MAJOR_VERSION=1)
The GCC Prerequisites page jumped the gun and is showing the prerequisites for GCC 4.8.
GCC 4.7.2 still uses PPL instead of ISL, as evidenced by the lack of --with-isl=PATH in the output of configure:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
--with-mpc=PATH specify prefix directory for installed MPC package.
Equivalent to --with-mpc-include=PATH/include plus
--with-mpc-lib=PATH/lib
--with-mpc-include=PATH specify directory for installed MPC include files
--with-mpc-lib=PATH specify directory for the installed MPC library
--with-mpfr-dir=PATH this option has been REMOVED
--with-mpfr=PATH specify prefix directory for installed MPFR package.
Equivalent to --with-mpfr-include=PATH/include plus
--with-mpfr-lib=PATH/lib
--with-mpfr-include=PATH
specify directory for installed MPFR include files
--with-mpfr-lib=PATH specify directory for the installed MPFR library
--with-gmp-dir=PATH this option has been REMOVED
--with-gmp=PATH specify prefix directory for the installed GMP
package. Equivalent to
--with-gmp-include=PATH/include plus
--with-gmp-lib=PATH/lib
--with-gmp-include=PATH specify directory for installed GMP include files
--with-gmp-lib=PATH specify directory for the installed GMP library
--with-host-libstdcxx=L use linker arguments L to link with libstdc++ when
linking with PPL
--with-stage1-ldflags=FLAGS
linker flags for stage1
--with-stage1-libs=LIBS libraries for stage1
--with-boot-libs=LIBS libraries for stage2 and later
--with-boot-ldflags=FLAGS
linker flags for stage2 and later
--with-ppl=PATH specify prefix directory for the installed PPL
package. Equivalent to
--with-ppl-include=PATH/include plus
--with-ppl-lib=PATH/lib
--with-ppl-include=PATH specify directory for installed PPL include files
--with-ppl-lib=PATH specify directory for the installed PPL library
--with-cloog=PATH Specify prefix directory for the installed CLooG-PPL
package. Equivalent to
--with-cloog-include=PATH/include plus
--with-cloog-lib=PATH/lib
--with-cloog-include=PATH
Specify directory for installed CLooG include files
--with-cloog-lib=PATH Specify the directory for the installed CLooG
library
--with-build-sysroot=SYSROOT
use sysroot as the system root during the build
--with-debug-prefix-map='A=B C=D ...'
map A to B, C to D ... in debug information
--with-build-config='NAME NAME2...'
use config/NAME.mk build configuration
--with-build-time-tools=PATH
use given path to find target tools during the build
It's unfortunate that they don't maintain prerequisites pages for versions prior to 4.8.