Closed YunxiangLuo closed 4 weeks ago
duo,duo256,duos musl编译c语言,使用以下例子程序,printf不带\n时不能正常输出
环境:官方buildroot image 编译工具:https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz riscv64-unknown-linux-musl-gcc -march=rv64gcv0p7xthea
riscv64-unknown-linux-musl-gcc -march=rv64gcv0p7xthea
测试使用的程序:
my_app.c
#include <stdio.h> #include "greeting.h" #define N 10 int main(void) { char name[N]; printf("Your name,Please:"); scanf("%s",name); greeting(name); return 0; }
greeting.h
#ifndef GREETING_H_ #define GREETING_H_ void greeting(char *name); #endif
greeting.c
#include<stdio.h> #include"greeting.h" void greeting(char *name) { printf("Hello %s!\r\n",name); }
操作步骤如下,print在未加/n时未同x86一样正常打印
riscv64-unknown-linux-musl-gcc -fPIC -shared greeting.c -o libgreeting.so riscv64-unknown-linux-musl-gcc -march=rv64gcv0p7xthead -g -L . -lgreeting my_app.c -o demo #拷贝.so 和 demo到duo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./demo
duo,duo256,duos musl编译c语言,使用以下例子程序,printf不带\n时不能正常输出
环境:官方buildroot image 编译工具:https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz
riscv64-unknown-linux-musl-gcc -march=rv64gcv0p7xthea
测试使用的程序:
my_app.c
greeting.h
greeting.c
操作步骤如下,print在未加/n时未同x86一样正常打印