-
Notifications
You must be signed in to change notification settings - Fork 15
No .EXE on Windows 10 #22
Comments
Do you have VS or VS Build Tools installed? |
Do you have VS or VS Build Tools installed?
No, I don't get on with large build tools. I only tried this because there
happened to be a Windows binary available.
Here's a transcript, first, the starting files in my test set-up (this is
supposed to be fixed-pitch but that doesn't appear to work):
c:\c3>dir
12/08/2022 11:14 80,811,520 c3c.exe
12/08/2022 11:48 89 hello.c3
12/08/2022 11:14 <DIR> lib
3 File(s) 80,811,616 bytes
The contents of that test input:
c:\c3>type hello.c3
module hello_world;
import std::io;
fn void main()
{
io::println("Hello, world!");
}
Now I follow the instructions to build hello-world:
c:\c3>c3c compile hello.c3
c:\c3>
So it completes after a few seconds (usually about 3 seconds). Now there
are these files:
c:\c3>dir
12/08/2022 11:14 80,811,520 c3c.exe
12/08/2022 11:48 89 hello.c3
13/08/2022 23:46 561 hello_world.obj
12/08/2022 11:14 <DIR> lib
13/08/2022 23:46 5,728 libc.errno.obj
13/08/2022 23:46 1,014 libc.obj
13/08/2022 23:46 2,225 math.obj
13/08/2022 23:46 306 std.atomic.obj
13/08/2022 23:46 603 std.core.builtin.obj
13/08/2022 23:46 611 std.core.cinterop.obj
13/08/2022 23:46 682 std.core.env.obj
13/08/2022 23:46 37,627 std.core.mem.allocator.obj
13/08/2022 23:46 306 std.core.mem.array.obj
13/08/2022 23:46 8,012 std.core.mem.obj
13/08/2022 23:46 306 std.core.os.linux.obj
13/08/2022 23:46 306 std.core.os.macos.obj
13/08/2022 23:46 404 std.core.os.windows.obj
13/08/2022 23:46 7,488 std.core.str.obj
13/08/2022 23:46 10,181 std.core.string.conv.obj
13/08/2022 23:46 1,498 std.core.string.iterator.obj
13/08/2022 23:46 13,675 std.core.string.obj
13/08/2022 23:46 365 std.core.types.obj
13/08/2022 23:46 2,130 std.hash.adler32.obj
13/08/2022 23:46 3,221 std.hash.crc32.obj
13/08/2022 23:46 4,246 std.hash.crc64.obj
13/08/2022 23:46 51,573 std.io.obj
13/08/2022 23:46 21,242 std.math.matrix.obj
13/08/2022 23:46 3,364 std.math.obj
13/08/2022 23:46 306 std.runtime.obj
30 File(s) 80,990,223 bytes
My guess is that it didn't complete properly, since these are an untidy set
of intermediate files to leave lying around. Machine is a Windows 10 PC as
I said.
I tried this also inside a directory (as the info said the library must be
at ../lib); same result. That doesn't seem to be the issue however as it
would have reported anything wrong.
HTH
|
This is because you lack the .lib files C3 needs to link with, so unfortunately it's either the build tools or VS at this point. I'll try to minimize what's needed and see if C3 can't grab those things automatically on windows. But right now it's unfortunately so that an install is needed. Either with VS or the build tools from here: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022 |
To explain a bit more in detail: C3 has a linker built in, so it's not necessary to use link.exe on windows. However, the .lib files to link to windows libc is still necessary. Because linking isn't working, what you're left with are the generated object files, but no linked exe. And the reason why there isn't a linked exe is because the .lib files it needs are missing – and the only way to get those is by downloading them from MS. |
OK, so the product needs MS tools to complete the linking process? So a bit
like Rust (if it still does so) and Clang. (I thought you wanted me to
build from source.)
Reading the docs more carefully, yes it does say install VS 2022 first, a
rather massive download. I did try the MSBUILD tools at your link, however
it didn't work, even working from the special Developer Command Prompt.
As I said, these things never work for me. (Which specific binary does it
need, or which files are being requested, and how/where does it look for
them?)
c3c.exe is a quite substantial executable, enough that people might think
it would contain everything needed. But even if not, they would expect it
to report that something was missing ('File xxx not found') rather than
silently failing.
(The tools I develop myself are less than 1/100th the size, are
self-contained, and for basic functionally - such as printing a string -
don't require additional libraries beyond what are already provided by the
1000s of DLLs that come with Windows.
Linking to these DLLs (if that is what your product does) is done directly,
without intermediate .LIB files, as some other compilers can do. For
'hello, world', it works on top of `printf` exported by the C library
MSVCRT.DLL.
Most Windows programs seem to import MSVCRT.DLL, including the C compilers
tcc.exe and gcc.exe. Not however c3c.exe; I had a look!)
…On Sun, 14 Aug 2022 at 00:50, Christoffer Lerno ***@***.***> wrote:
This is because you lack the .lib files C3 needs to link with, so
unfortunately it's either the build tools or VS at this point. I'll try to
minimize what's needed and see if C3 can't grab those things automatically
on windows. But right now it's unfortunately so that an install is needed.
Either with VS or the build tools from here:
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022
—
Reply to this email directly, view it on GitHub
<#22 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALKCRBZWP5NPVITVANQFSULVZAYC5ANCNFSM56LIQMHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
To explain: The problem is that while some files can be distributed, some may not and that includes the .lib for linking to the libc runtime. The only legal way is therefore to ask the user to download these files directly from MS. That is the problem. For detecting VS, there's a rather short but complicated piece of code doing tricks to try to find VS or VS build tools, since the actual path may vary. I did not author that code, nor did I introduce it to the code base. My suspicion is that this fails silently, giving you the poor user experience you have right now. I'm not set up on MSVC, and I mainly fix things by trial and error using CI, which is why it is poorly tested. |
I have some hope that this will change though. I will try to provide a script to pull in the necessary libraries and collect them in the c3c install folder allowing one to avoid downloading the full build tools and just keep the relevant .libs for compilation. |
Finally, the size of c3c is mainly due to LLVM. Note that it is compiled with full cross compilation capabilities on a wide set of targets. Plus it also bundles linkers in the same platform. The actual compiler is very small in comparison. Even before linking the adding up the sizes of all object files gives you less than 6 MB of code. The binary is 130 MB on my machine... |
I want to mention that we now have a script to pull in all the dependencies needed to build on windows without the need for downloading the build tools manually. |
There's now a Windows binary which I tried out. But
c3c compile hello.c3
produces onlyhello_world.obj
(plus 20+ other *.obj files), no .exe.What do I have to do to get
hello.exe
?compile-run
did the same.(Possibly it might be crashing; on this Windows 10 machine, if does so silently, although sometimes it shows a brief busy cursor which I've noticed here on some attempts.)
The text was updated successfully, but these errors were encountered: