1

I am trying to build a Linux by using Linux from scratch tutorial ,but i can't explain this,when i run multiple command as this step describe:

CC=$LFS_TGT-gcc                \
AR=$LFS_TGT-ar                 \
RANLIB=$LFS_TGT-ranlib         \
../binutils-2.24/configure     \
    --prefix=/tools            \
    --disable-nls              \
    --with-lib-path=/tools/lib \
    --with-sysroot

I get errors like :

configure: error: cannot run C compiled programs.

But when i separate this part:

CC=$LFS_TGT-gcc                \
AR=$LFS_TGT-ar                 \
RANLIB=$LFS_TGT-ranlib         \ 

from this part:

../binutils-2.24/configure     \
    --prefix=/tools            \
    --disable-nls              \
    --with-lib-path=/tools/lib \
    --with-sysroot

And run them in two sequential sequence,it goes good,without error.as i know first part define some system variable and second part configure the program,but i don't realize why the combination give me an error? and is it okey to run them separately?

  • What does file $LFS_TGT-gcc $LFS_TGT-ar $LFS_TGT-ranlib output? The cannot run C compiled programs error indicates that they're not recognized as executables on your current OS. Are you running on a filesystem that is nosuid or encrypted? – Mark Plotnick Sep 9 '14 at 15:31
  • apparently those files don't exist,i don't know when they suppose to create!i do exact steps. – zokit Sep 9 '14 at 16:25
  • OK, you can go back and repeat older steps. To answer part of your question: when you have variable=value on the beginning of the same line as a command, it temporarily puts that variable in the command's environment. So CC=this AS=that configure will temporarily make configure use those values for CC and AS instead of the ones it uses by default. This is important if you're compiling software for a different target architecture than the one you're on. – Mark Plotnick Sep 9 '14 at 16:34
0

From Page xviiii in the typography section:

In some cases, a logical line is extended to two or more physical lines with a backslash at the end of the line.

Note that the backslash must be followed by an immediate return. Other whitespace characters like spaces or tab characters will create incorrect results.

Please note that these commands could be one-liners but contain the backslash to increase readability.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.