Skip to contentSkip to conversation

build.sh: support compiler with path prefix

PATCH New Li Zhijian 3 participants 4 messages Jan 11, 2021

lore
Share & tools
lore

Li Zhijian

author
#0 lore raw

PATCH 1/1 build.sh: support compiler with path prefix

Previously, specify a compiler with path prefix will lead to a error like below:
ltp$ ./build.sh -t cross -c /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc
...
It was created by ltp configure LTP_VERSION, which was generated by GNU Autoconf 2.69. Invocation command line was

  $ ./configure --with-open-posix-testsuite --with-realtime-testsuite --prefix=/home/lizj/ltp-install --host=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux CROSS_COMPILE=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-
...
 #define VERSION "LTP_VERSION"

configure: exit 1

---
 build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
build.sh +1 -1
index 452cc6f4c..a662c9cb4 100755
@@ -64,7 +64,7 @@ build_cross()
 	fi
 
 	echo "===== cross-compile ${host} ${1}-tree build into $PREFIX ====="
-	build $1 $2 "--host=$host" CROSS_COMPILE="${host}-"
+	build $1 $2 "--host=$(basename $host)" CROSS_COMPILE="${host}-"
 }
 
 build()
Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/1 build.sh: support compiler with path prefix

Quoted 23 lines · Li Zhijian

Previously, specify a compiler with path prefix will lead to a error like below:
ltp$ ./build.sh -t cross -c /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc
...
It was created by ltp configure LTP_VERSION, which was generated by GNU Autoconf 2.69. Invocation command line was

   $ ./configure --with-open-posix-testsuite --with-realtime-testsuite --prefix=/home/lizj/ltp-install --host=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux CROSS_COMPILE=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-
...
  #define VERSION "LTP_VERSION"

configure: exit 1

---
  build.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
build.sh +0 -0
index 452cc6f4c..a662c9cb4 100755

build.sh build_cross() · line 67

Quoted 5 lines
build.sh +1 -1
@@ -64,7 +64,7 @@ build_cross()
  	fi
 
  	echo "===== cross-compile ${host} ${1}-tree build into $PREFIX ====="
-	build $1 $2 "--host=$host" CROSS_COMPILE="${host}-"
+	build $1 $2 "--host=$(basename $host)" CROSS_COMPILE="${host}-"

Hi Petr,

CROSS_COMPILE seems unneeeded, right?
Other than that it looks good to me.

Best Regards,
Xiao Yang

Quoted 3 lines
build.sh +0 -0
  }
 
  build()
author
#2 lore raw

PATCH 1/1 build.sh: support compiler with path prefix

Quoted 26 lines · yangx.jy
Quoted 25 lines · Li Zhijian

Previously, specify a compiler with path prefix will lead to a error like below:
ltp$ ./build.sh -t cross -c /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc
...
It was created by ltp configure LTP_VERSION, which was generated by GNU Autoconf 2.69.? Invocation command line was

?? $ ./configure --with-open-posix-testsuite --with-realtime-testsuite --prefix=/home/lizj/ltp-install --host=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux CROSS_COMPILE=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-
...
? #define VERSION "LTP_VERSION"

configure: exit 1

---
? build.sh | 2 +-
? 1 file changed, 1 insertion(+), 1 deletion(-)

build.sh +0 -0
index 452cc6f4c..a662c9cb4 100755
@@ -64,7 +64,7 @@ build_cross()

????? fi

Quoted 6 lines
Quoted 3 lines

????? echo "===== cross-compile ${host} ${1}-tree build into $PREFIX =====" -??? build $1 $2 "--host=$host" CROSS_COMPILE="${host}-"
+??? build $1 $2 "--host=$(basename $host)" CROSS_COMPILE="${host}-"

Hi Petr,

CROSS_COMPILE seems unneeeded, right?

Indeed,? CROSS_COMPILE was no longer used since 400ac9bbe20: build: Remove {config.h,config.mk,features.mk,}.default

Thanks

Quoted 9 lines

Other than that it looks good to me.

Best Regards,
Xiao Yang

Quoted 3 lines

? }

? build()

#3 lore raw

PATCH 1/1 build.sh: support compiler with path prefix

In reply to Li Zhijian

Hi Li,

Quoted 8 lines

Previously, specify a compiler with path prefix will lead to a error like below:
ltp$ ./build.sh -t cross -c /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc
...
It was created by ltp configure LTP_VERSION, which was generated by GNU Autoconf 2.69. Invocation command line was

  $ ./configure --with-open-posix-testsuite --with-realtime-testsuite --prefix=/home/lizj/ltp-install --host=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux CROSS_COMPILE=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-

Thanks for your fix.

Although I expected use basename and set PATH, e.g.:
CROSS_COMPILE=mips64el-linux- PATH="/opt/gcc-4.9.3-64-gnu/bin/:$PATH" it's obviously good to support full path for $CROSS_COMPILE

Kind regards,
Petr

...

Quoted 2 lines
build.sh +1 -1
-	build $1 $2 "--host=$host" CROSS_COMPILE="${host}-"
+	build $1 $2 "--host=$(basename $host)" CROSS_COMPILE="${host}-"

...