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

Fix some template declarations not setting namespace #1913

Merged
merged 3 commits into from
Feb 14, 2025

Conversation

duckdoom5
Copy link
Contributor

Also added a minor optimization since adding the GetNamespace() calls slowed it down a lot

@duckdoom5 duckdoom5 force-pushed the fix/missing-namespace-assignments branch from 53b1d76 to 1894b6b Compare February 13, 2025 17:20
@duckdoom5
Copy link
Contributor Author

How do we update bindings for other platforms? Can I just generate them on my windows device?

@duckdoom5
Copy link
Contributor Author

Should we maybe automate generating all parser bindings as well?

@tritao
Copy link
Collaborator

tritao commented Feb 13, 2025

How do we update bindings for other platforms? Can I just generate them on my windows device?

Yes, and yes, get the headers package here: https://github.com/mono/CppSharp/releases/download/CppSharp/headers.zip

I think it needs to be extracted to build/ and then Parser.Gen should automatically pick it up.

We once had it setup so they would get automatically generated as part of the build, or maybe as a post-commit hook.

But it caused issues and we eventually took it out.

These days I think it would work quite well as a pre-commit hook that automatically updates a PR branch with the latest bindings.

@duckdoom5
Copy link
Contributor Author

duckdoom5 commented Feb 14, 2025

Hm, the linux version gives me errors

C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/cdefs.h(763,2): error: Unsupported architecture
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\machine/_types.h(34,2): error: architecture not supported
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(55,9): error: unknown type name '__int64_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(56,9): error: unknown type name '__int32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(57,9): error: unknown type name '__int32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(60,9): error: unknown type name '__uint32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(61,9): error: unknown type name '__uint32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(62,9): error: unknown type name '__uint64_t'; did you mean 'uint64_t'?
...
...

@tritao
Copy link
Collaborator

tritao commented Feb 14, 2025

Hm, the linux version gives me errors

C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/cdefs.h(763,2): error: Unsupported architecture
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\machine/_types.h(34,2): error: architecture not supported
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(55,9): error: unknown type name '__int64_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(56,9): error: unknown type name '__int32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(57,9): error: unknown type name '__int32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(60,9): error: unknown type name '__uint32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(61,9): error: unknown type name '__uint32_t'
C:\SSD_WorkProjects\CppSharp\build\headers\osx\include\sys/_types.h(62,9): error: unknown type name '__uint64_t'; did you mean 'uint64_t'?
...
...

I assume you meant macOS, right?

@duckdoom5
Copy link
Contributor Author

Hah, yes XD. Though linux also gives me an error:

C:\SSD_WorkProjects\CppSharp\build\headers\x86_64-linux-gnu/usr/include\gnu/stubs.h(7,11): fatal: 'gnu/stubs-32.h' file not found

@duckdoom5
Copy link
Contributor Author

duckdoom5 commented Feb 14, 2025

Both errors occur when building ARM64. The others work fine

Generating the C# parser bindings for OSX ARM64...
Generating the C# parser bindings for Linux ARM64...
Generating the C# parser bindings for Linux ARM64 (GCC C++11 ABI)...

@tritao
Copy link
Collaborator

tritao commented Feb 14, 2025

Both errors occur when building ARM64. The others work fine

Generating the C# parser bindings for OSX ARM64...
Generating the C# parser bindings for Linux ARM64...
Generating the C# parser bindings for Linux ARM64 (GCC C++11 ABI)...

Yes, we updated the headers package recently for ARM64, I think that version I linked is the old one, but am not finding the updated one, I'll see if I can find it.

@duckdoom5
Copy link
Contributor Author

Also, shouldn't we set the target arch compiler flag here?
image

@duckdoom5
Copy link
Contributor Author

I noticed arm64 is not part of the CI. Should we add those?

@tritao
Copy link
Collaborator

tritao commented Feb 14, 2025

About the headers, I might have been thinking about: #1825 (comment)

I have built a new package with the headers from that link, but updated the macOS headers with recent macOS ARM64 ones too, can you see if this helps?

headers.zip

Though you updated the PR now and its green now, did you fix it manually?

I noticed arm64 is not part of the CI. Should we add those?

I am not sure what's the status on it, see #1825 maybe.

For macOS it's not possible either until we generally get #1879.

We can get the generator to work in macOS ARM64 by not relying on std::string for parser bindings (as it once was), but generally for all tests to work, CppSharp will need a separate C-ABI bindings generation mode. See the whole saga at dotnet/runtime#106471.

@duckdoom5
Copy link
Contributor Author

Though you updated the PR now and its green now, did you fix it manually?

Yeah, so with the old header package I was able to generate the non-arm64 bindings for osx and linux.

They are green cus the arm64 bindings don't get tested by CI.

I'm off for the weekend though, and I currently have no interest in the arm64 version so if I can leave that for someone else that'd be great, but I understand wanting to keep them in sync so lmk.

@tritao
Copy link
Collaborator

tritao commented Feb 14, 2025

Though you updated the PR now and its green now, did you fix it manually?

Yeah, so with the old header package I was able to generate the non-arm64 bindings for osx and linux.

They are green cus the arm64 bindings don't get tested by CI.

I'm off for the weekend though, and I currently have no interest in the arm64 version so if I can leave that for someone else that'd be great, but I understand wanting to keep them in sync so lmk.

Neither do I at the moment, so I think we're good 👍

If you generate the bindings again, do use this new package so we can at least keep it in sync as you said.

@tritao tritao merged commit fe7afc3 into mono:main Feb 14, 2025
8 checks passed
@duckdoom5 duckdoom5 deleted the fix/missing-namespace-assignments branch February 14, 2025 20:56
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

Successfully merging this pull request may close these issues.

2 participants