Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No output #6

Open
Ivo-Balbaert opened this issue Dec 18, 2022 · 7 comments
Open

No output #6

Ivo-Balbaert opened this issue Dec 18, 2022 · 7 comments

Comments

@Ivo-Balbaert
Copy link

When running: D:\Qat\qat_v0.6.1-alpha_windows_amd64>qat run main.qat

with main.qat:

main() [
    say "Hello, World!".
]

I see not output from say. Any idea what might go wrong here?

@AldrinMathew
Copy link
Member

@Ivo-Balbaert
This was a bug in the 0.6.1 version. A few versions before that, when running built executables worked, the compiler assumed only one executable to run. After that, the system was changed to support multiple executables, however, the actual step of running was commented out. This should be fixed in the next release.
I will be pinging here when the next release happens.

@AldrinMathew
Copy link
Member

Thanks for showing interest, pointing this out and contributing to the project. I appreciate your feedback and effort.

@AldrinMathew AldrinMathew transferred this issue from qatlang/docs Dec 23, 2022
@AldrinMathew
Copy link
Member

The issue has been fixed in the latest release 0.7.0 available for Windows and Linux

@Ivo-Balbaert
Copy link
Author

D:\Qat\qat_v0.7.0_windows_amd64>qat -version

D:\Qat\qat_v0.7.0_windows_amd64>qat -v

D:\Qat\qat_v0.7.0_windows_amd64>qat run main.qat

D:\Qat\qat_v0.7.0_windows_amd64>

@AldrinMathew AldrinMathew reopened this Feb 6, 2023
@AldrinMathew
Copy link
Member

@Ivo-Balbaert
I have found the issue. There is a function the compiler uses to search for executables. In posix systems, which command is used. In windows, SearchPath is used which is not providing the correct result in the tests I did recently. The compiler log is saying that it cannot find clang on path in the debug builds. The reason I stated previously was valid, but already resolved. So now that I think about it, this has also been a problem from the beginning, which is why the compilation is not successful now.

qat version is the command to use to see the version of the compiler. I will also include another popular command used for the same purpose in other executables, in the next release.

@Ivo-Balbaert
Copy link
Author

Thanks for looking into this!

@AldrinMathew
Copy link
Member

AldrinMathew commented Feb 6, 2023

@Ivo-Balbaert
The SearchPath issue has been solved by using where command in windows. But there are more problems in the Windows compiler. Compiling & linking the LLVM files with clang, causes the linker to throw the following error:

C:/msys64/mingw64/bin/ld: C:/msys64/mingw64/lib\libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'

This is fixed by using lld by adding -fuse-ld=lld to the compilation command.

However, at this point, running the built executable causes segfaults. I looked into it. I removed say "Hello, World!". and compiled again, and there is no error whatsoever. say uses printf under the hood which is properly linked in POSIX systems, but turns out, not so much in a windows system. I updated the compiler to use __mingw_vprintf instead in windows, but no change in the result.

I will look more into this and see how I can properly link C runtime. Manually passing -Lc doesn't work either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants