c3lang / c3c

Compiler for the C3 language

Home Page:https://c3-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wincrt property seems to be ignored by `manifest.json`.

vorban opened this issue · comments

Environment

Fresh installation with the latest release timestamped at 2024-08-06 01:12 AM GMT+2.

OS:                        Windows 10
C3 Compiler Version:       0.6.2 (prerelease)
Installed directory:       C:/Program Files/c3/
LLVM version:              18.1.8
LLVM default target:       x86_64-pc-windows-msvc

Expected behaviour

The command c3c --list-manifest-properties documents a wincrt property.
Using "wincrt": "none" in either targets.{target}.wincrt or at the root of the manifest should disable wincrt linking.

Sample manifest.json:

{
  "provides" : "raylib",
  "targets" : {
    "windows-x64" : {
      "link-args": [],
      "dependencies" : [],
      "linked-libraries" : [
          "raylib"
      ],
      "wincrt": "none" // <- either here
    }
  },
  "wincrt": "none" // <- or here
}

This specific configuration should fail to resolve all kinds of names from user32, gdi, and other windows DLLs. That would be the expected behaviour😄.

Actual behaviour

While the same property is functional from the project.json context, it does not seem to have any effet when provided inside manifest.json. When linking with Raylib this results in:

> c3c build
lld-link: error: duplicate symbol: __report_gsfailure
>>> defined at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\gs\gs_report.c:217
>>>            msvcrt.lib(gs_report.obj)
>>> defined at VCRUNTIME140.dll
Failed to create an executable: (null)

I've tried to use the latest release of raylib 4.x from: https://github.com/c3lang/vendor, and I fail to make it work (duplicate symbol: __report_gsfailure [...] defined at VCRUNTIME140.dll).

I've tried to make my own raylib.c3l with c3c init-lib raylib, zipping the whole thing (following the rb script from the vendor repository). I get the same duplicate symbol [...] error, indicating the property does nothing.

When making a project without a c3 library, instead linking with raylib and using the wincrt property from the project.json file, it works like a charm.

Steps to reproduce

  1. Init a new c3 library. Link with raylib, setup wincrt property to none.
  2. Init a new c3 project. Add your c3 library to the project, use it in main
  3. Run c3c build

I'm not sure if I missed something or if this is indeed broken. This is my first day trying out the language so it's probable I've misinterpreted the documentation.

Thank you for the thorough bug report. I've updated this in master so hopefully you are able to verify that this works in about 45 minutes when the build should be complete.

Hello! I've tested this with the latest prerelease (Aug 18th 2024) and it seems to work as intended.

Thanks!