top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Compiling GCC for different machine on same Architecture

0 votes
165 views

We are trying to build our code base for CentOS 7 machine with x86_64 architecture on CentOS6 with x86_64.

For that we are trying to build a centos7 Toolchain. All the gcc/ld/ar should be statically linked, so that we are ensuring that it will not uses any native centos6 stuff.

In this process, we are able to generate statically linked GCC/AR/LD. But problem was this GCC not generating a statically linked binaries and fails while checking flags during configure at "checking static
flag -static ". Due to this while running those binaries it refers to native libgcc and fails.

We are using the below command for configure.

../gcc../configure -prefix=/mnt/data0/toolchain-vm-temp2 --build=x86_64-CentOS7-linux-gnu-with sysroot=/mnt/data0/tools/gnutools/toolchain-vm --disable-nls --disable-multilib --enable-languages=c,c++ --disable-sim --enable-symvers=gnu --enable__cxa_atexit --enable-lto --with-gnu-ld --enable-static

Can Anyone provide solution or how to achieve this task.

posted Sep 2, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Install CentOS 7 in a virtual machine.

1 Answer

0 votes

It's pretty straightforward to build software for "other" distributions using modern versions of GCC... depending on how many dependencies the software has.

For basic system library requirements for a Red Hat system, for example, you just need to get a copy of the base and "devel" RPMs for each of those libraries from the release you want to target, unpack them into a separate directory, then add the --sysroot flag to your invocation of GCC pointing at that directory.

So for example if you get the glibc, glibc-common, glibc-devel, glibc-headers, libgcc, and kernel-headers packages from RHEL5 then unpack them into a directory like "/home/sysrooots/rhel5" (I use cpio with the --no-absolute-filenames option to unpack the RPM) you'll get stuff like:

 /home/sysroots/rhel5/usr/include/...
 /home/sysroots/rhel5/usr/lib/...
 /home/sysroots/rhel5/lib/...
 etc.

Then run "gcc --sysroot /home/sysroot/rhel5 ..." for both compilation AND linking.

Obviously if your software needs more libraries you'll have to add more RPMs, and the farther up the "stack" you go, away from the base system libraries, the more complex and less portable things become.

answer Sep 2, 2014 by Deepti Singh
Similar Questions
+3 votes

I am following instructions from
https://gcc.gnu.org/wiki/Offloading

I'm using the configure line for Nvidia ptx. The build stops in configuring nvptx-none/libgfortran with error:

checking whether symbol versioning is supported... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

My host OS is CentOS 6.5. I'm using gcc 4.7 (built with system gcc 4.4) to build gcc 5.1

Can someone give me hint to look where the problem could come from ?

+2 votes

I am getting following error when compiling my program with gcc version 4.9.0

gcc --version
gcc (GCC) 4.9.0 20131023 (experimental)

Error

./A.out: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./A.out)

But I gcc 4.7.3 is fine. Any guess why this may be happening.

+1 vote

I need to access in-memory representation of both the source program(the program before compilation) and target program(the program after compilation) at the same time. If I add a plugin between two passes,say p1 and p2, I will be able to access the program produced by only p1 but I would neither be able to access the program which was before executing p1 nor the program after p2. I want to compare the programs before and after compilation. How to do that?

+1 vote

I'm on /dev/sda7. I want to install gcc with C++ support in /dev/sda2.

  1. Is it possible to install gcc in /dev/sda2?
  2. What are the dependencies to install gcc? Or which packages should I install there in /dev/sda2 before installing gcc?
  3. What is cross compiler? How can I install gcc as cross compiler? When do we need to install gcc as cross compiler?
  4. Can someone explain the method of installing cross compiled gcc?
0 votes

Currently I compile gcc version 6.2.1 20161117 and I'm running very simple code that use 32 gangs,

I compile it with gcc -fopenacc -o3 -o piexample.x piexample.c with the following env.

export GOMP_DEBUG=1
export ACC_DEVICE_TYPE=nvidia

The problem is that anyone number of gangs that i use, the result is always the same: only 1 gang.

GOACC_parallel_keyed: mapnum=1, hostaddrs=0x7fffc872dff0, size=0x6012c0, kinds=0x6012b8
nvptx_exec: prepare mappings
nvptx_exec: kernel main$_omp_fn$0: launch gangs=1, workers=1, vectors=32
nvptx_exec: kernel main$_omp_fn$0: finished
GOACC_data_end: restore mappings
GOACC_data_end: mappings restored

If compile it with PGI compiler the number of gangs is setter correctly,

main:
12, Generating copy(pi)
14, Loop is parallelizable
Accelerator kernel generated
Generating Tesla code
14, #pragma acc loop gang(32), worker(8), vector(8) /*blockIdx.x threadIdx.y threadIdx.x */
16, Generating implicit reduction(+:pi)

Some ideas about the problem ?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...