Bug 873 - clang编译.c文件报错
Summary: clang编译.c文件报错
Status: CONFIRMED
Alias: None
Product: Anolis OS 7
Classification: Anolis OS
Component: Images&Installations (show other bugs) Images&Installations
Version: 7.9
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: layne-yang
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-21 16:56 UTC by chuyang_94
Modified: 2022-08-04 15:42 UTC (History)
4 users (show)

See Also:


Attachments
centos7.9 test pic (244.57 KB, image/jpeg)
2022-05-05 17:20 UTC, 刘小平
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chuyang_94 alibaba_cloud_group 2022-04-21 16:56:33 UTC
Description of problem:
加载Anolis7.9 ARM64镜像后,使用clang编译.c文件时,出现错误
# clang hello.c -o hello2
/usr/bin/ld: 找不到 crtbegin.o: 没有那个文件或目录
/usr/bin/ld: 找不到 -lgcc
/usr/bin/ld: 找不到 -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Version-Release number of selected component (if applicable):
# cat /etc/image-id
image_name="Anolis OS 7.9 RHCK 64 bit ARM Edition"
image_id="anolisos_7_9_arm64_20G_rhck_alibase_20220413.vhd"
release_date="20220413173429"

# clang -v
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: aarch64-redhat-linux-gnu
Thread model: posix
Selected GCC installation:

gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/4.8.5/lto-wrapper
目标:aarch64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.openanolis.cn --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-aarch64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-aarch64-redhat-linux/cloog-install --enable-gnu-indirect-function --build=aarch64-redhat-linux
线程模型:posix
gcc 版本 4.8.5 20150623 (Anolis 4.8.5-44.0.1) (GCC)

How reproducible:
必现

Steps to Reproduce:
1.部署anolisos_7_9_arm64_20G_rhck_alibase_20220413.vhd镜像
2.安装clang yum install clang -y
3.编写简单的.c文件,如:
#include<stdio.h>
int main() {
    printf("Hello World!\n");
    return 0;
}
4、使用clang编译:
clang hello.c -o hello


Actual results:
编译出错,未生成对应可执行文件

Expected results:
编译成功,生成可执行文件且可正常运行

Additional info:
Comment 1 杨晓旋 uniontech_group 2022-05-05 16:10:39 UTC
anolis7 中不提供clang,bug中的clang包是通过epel源拉入的。不在支持范围内。
Comment 2 刘小平 alibaba_cloud_group 2022-05-05 17:20:22 UTC
Created attachment 216 [details]
centos7.9 test pic

centos7.9 aarch64存在相同问题 暂时降低优先级
Comment 3 liuyaqing alibaba_cloud_group 2022-07-15 13:53:28 UTC
6月份镜像 anolisos_7_9_arm64_20G_anck_alibase_20220701.vhd 有相同问题
Comment 4 liuyaqing alibaba_cloud_group 2022-08-04 15:42:30 UTC
7月份镜像测试anolisos_7_9_arm64_20G_anck_alibase_20220727.vhd有相同问题