Sorry for the delay in reviewing it.

On Friday, February 19, 2021 at 5:38:40 PM UTC-5 punit wrote:

> When cross compiling, it would be good to support the following two 
> cases - 
>
> * Distro provided cross compiler + libraries - This is the case when a 
> distro with multi-arch support (e.g., Debian derivaties) 
>
> * Local libraries installation - Needed when the distro doesn't 
> support multi-arch or there's a need to use local installs 
>
> Update the libgcc detection to query the compiler regarding the 
> location of the libraries - provided the correct CROSS_PREFIX is 
> specified. If this fails to find the library, fall back to the hard 
> coded location. Also, add a message to inform the user about the 
> fallback usage. 
>
> Signed-off-by: Punit Agrawal <[email protected]> 
> --- 
> scripts/build | 20 ++++++++++++-------- 
> 1 file changed, 12 insertions(+), 8 deletions(-) 
>
> diff --git a/scripts/build b/scripts/build 
> index 5fdcc7a88214..fd03af658fb6 100755 
> --- a/scripts/build 
> +++ b/scripts/build 
> @@ -270,17 +270,21 @@ kernel_end=$(($loader_size+2097151 & ~2097151)) 
> # the case in our old build.mk). 
> cd $OUT 
>
> +CC=gcc 
> host_arch=$(uname -m) 
> if [[ "$host_arch" == "x86_64" && "$arch" == 'aarch64' ]]; then 
> - libgcc_s_path=$(${CROSS_PREFIX:-aarch64-linux-gnu-}gcc 
> -print-file-name=libgcc_s.so.1) 
> - if [[ "$libgcc_s_path" == "libgcc_s.so.1" ]]; then 
> - libgcc_s_dir=$(readlink -f 
> ../downloaded_packages/aarch64/gcc/install/lib64) 
> - else 
> - libgcc_s_dir=$(dirname $(readlink -f $libgcc_s_path)) 
> - fi 
> -else 
> - libgcc_s_dir=$(dirname $(readlink -f $(gcc 
> -print-file-name=libgcc_s.so.1))) 
> + CC=${CROSS_PREFIX:-aarch64-linux-gnu-}gcc 
> +fi 
> + 
> +libgcc_s_path=$(${CC} -print-file-name=libgcc_s.so.1) 
> +if [[ "$libgcc_s_path" == "libgcc_s.so.1" ]]; then 
> + cat <<-EOF 
> + Unable to resolve libgcc_s.so.1 using "${CC}". 
> + Looking in ../downloaded_packages/aarch64/gcc/install/lib64 
> + EOF 
> + libgcc_s_path=$(readlink -f 
> ../downloaded_packages/aarch64/gcc/install/lib64)

This part does not work on Fedora. I think it should be:
libgcc_s_path=$(readlink -f 
../downloaded_packages/aarch64/gcc/install/lib64/libgcc_s.so.1) 

>
> fi 
> +libgcc_s_dir=$(dirname $(readlink -f ${libgcc_s_path})) 
>
> if [ "$export" != "none" ]; then 
> export_dir=${vars[export_dir]-$SRC/build/export} 
> -- 
> 2.29.2 
>
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/515edbbc-2f51-4240-9c25-4071bccf0743n%40googlegroups.com.

Reply via email to