Closed qingw1230 closed 1 year ago
Please do not set the environment variable "MAPLE_HOME". The build error will not happen since irbuild.o will not be the make target without this environment variable. This part of the build is to create maple to whirl or whirl to maple for connecting open64 with maple compiler, aka, ark compiler. We shall talk if you really want to do this.
Those configure errors are harmless and can be ignored.
I don't need MAPLE. However, I want to print WHIRL IR. According to the instructions in osprey/ir_tools/README.md
, I need to use the following command to generate .B/.I/.O files before printing WHIRL IR.
openCC -clang -emit-llvm -fno-exceptions -O3 -OPT:malloc_alg=off -PHASE:c=off -c -sw -kp hello.c
Then, use the following command to convert it to ASCII format:
ir_b2a a.O
However, when I was using the command openCC -clang -emit-llvm -fno-exceptions -O3 -OPT:malloc_alg=off -PHASE:c=off -c -sw -kp hello.c
, I encountered the problem 'stddef.h' file not found when run openCC
, and the link to this issue is:open64/issues/16
Furthermore, after using the -I option to specify the header file path, I encountered the error use of undeclared identifier 'printf'
, which is the same as the issue mentioned above. I would like to know how to correctly print WHIRL IR.
I also want to use math library functions such as sin and cos, but opencc replaces them with fastsin. I found its declaration in the file below:
./osprey/libacml_mv/inc/acml_mv.h:double fastsin(double);
./osprey/libacml_mv/inc/acml_mv.h:void fastsincos(double , double *, double *);
./osprey/libacml_mv/inc/acml_mv.h:float fastsinf(float );
However, I encountered the following error during make install:
osprey/targdir_lib2/libacml_mv/libacml_mv.a does not exist
osprey/targdir_lib2/libacml_mv/libacml_mv.so.1 does not exist
Therefore, I get linking errors when using sin and cos.
/usr/bin/ld: /tmp/cco.Y35h6C: in function `main':
/test/TSVC/test_opencc/test.c:8: undefined reference to `fastsin'
collect2: ld returned 1 exit status
I found an environment for open64 on DockerHub.
docker pull opencc/open64:llvm15.w2ll
However, it did not solve the two issues mentioned above.
The files stddef.h
and stdarg.h
are no longer in /usr/include/
in the late Ubuntu like 22.04.
Mine are located in /usr/lib/gcc/x86_64-linux-gnu/11/include/
So I would add the option -I/usr/lib/gcc/x86_64-linux-gnu/11/include/
Open64 would support the libc
in llvm in the future.
Meanwhile, the libacml_mv
is deprecated now. It's too old to use.
Thank you, now I can print WHIRL IR.
Previously, I specified the path for stddef.h as -I/usr/include/linux
, but it was not successful.
Now the specified path is -I/usr/lib/gcc/x86_64-linux-gnu/9/include
and there is no problem.
Is there any way to prevent open64 from converting sin to fastsin? Or how can I use the functions in math.h
?
Assuming we have the following C code:
#include <stdio.h>
#include <math.h>
int main() {
for (int i = 0; i < 2; i++) {
int result = sin(i);
printf("%f\n", result);
}
return 0;
}
Using the following compilation options:
openCC -S test.c
Opening test.s will reveal the following contents:
cvtsi2sd %ebx,%xmm0 # [0]
.globl fastsin
call fastsin # [0] fastsin
It replaced the sin function with fastsin. Manually changing fastsin to sin allows the code to run properly. How can I prevent the substitution from happening?
Did you make any changes related to the libacml_mv
in the Makefile? We have removed it from the toolchain.
The sin
function in my a.s
file seems correct.
I didn't modify the Makefile file and I'm not sure what happened. Now I have installed open64 on two machines, one is working fine, but the other one has problems. This is a normal screenshot: This is the problematic one: Both machines have Ubuntu 20.04 operating system. The CPU of the problematic machine is: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
Have you checked out the develop branch?
I installed the w2ll branch on both machines. Just now, I reinstalled it on the problematic machine, but 'sin' was still replaced with 'fastsin'.
Try to add this option: -OPT:fast_math=0
I have no idea why the OPT_Fast_Math
is turned on.
https://github.com/open64-compiler/open64/blob/7e934651214049860141269bbadb457056745d51/osprey/be/com/emulate.cxx#L4646
After adding this option, it works fine.
The problematic machine did not report this warning. Is it related to this issue?
openCC WARNING: cannot deduce a supported CPU name from /proc/cpuinfo, defaulting to basic 64-bit x86.
Sounds possible.
When I use environment variable like below:
Configure「open64-w2ll/configure」has the following tips:
make no error, make install prompts missing libraries:
I can't use functions like fastsin, fastcos etc when using opencc。
When I use environment variable like below:
It is normal when configuring 「open64-w2ll/configure」, but the following error is reported when executing make:
Use
make -j1
to get the following information:I did not find the file 「mir_parser.h」. How can I get this file and build the open64 project correctly?