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

crosscompile xkbcommon on linux for windows (1/2) #305

Open
awarnke opened this issue Oct 31, 2022 · 3 comments
Open

crosscompile xkbcommon on linux for windows (1/2) #305

awarnke opened this issue Oct 31, 2022 · 3 comments
Labels
enhancement Indicates new feature requests good first issue Indicates a good issue for first-time contributors help wanted Indicates that a maintainer wants help on an issue or pull request os: Windows Windows-specific

Comments

@awarnke
Copy link

awarnke commented Oct 31, 2022

Hello,

crosscompiling xkbcommon on linux (OpenSuse 15.4) for windows works, when applying some changes:

  1. #ifdef _MSC_VER does not work when using the gnu cross compiler. I can fix this by setting this variable:

     meson configure -Dbuild.c_args=-D_MSC_VER=1
    

I guess this is just a hack, the right way would be to use another compiler variable. I'm no expert here - maybe _WIN32 is the right one, as used in other libraries:

src/fontconfig-2.13.96/src/fcxml.c:#ifdef _WIN32

src/libjpeg-turbo-2.1.3/tjexample.c:#ifdef _WIN32

src/expat-2.4.4/lib/xmlparse.c:#ifdef _WIN32

  1. There is another issue with the tests, I guess I best create another ticket for this.

Just a note: in meson.build,

elif cc.get_argument_syntax() == 'msvc'

does also not work, the cross compiler might have a different signature.

PS: Some infos on setting up cross-compile of libxkbcommon for win are documented here:
https://github.com/awarnke/crystal-facet-uml/tree/master/build/win

Kind Regards
Andreas

@bluetech
Copy link
Member

I'm no expert here - maybe _WIN32 is the right one, as used in other libraries:

No expert either, but this sounds OK to me, we can make this change.

elif cc.get_argument_syntax() == 'msvc' does also not work, the cross compiler might have a different signature.

Hmm this one does seem correct to me, here we do actually care about the specific compiler type.

What problem did this cause?

bluetech added a commit to bluetech/libxkbcommon that referenced this issue Apr 11, 2023
`_MSC_VER` is specific to MSVC, but there can be other compilers targeting
windows. Hopefully they do define `_WIN32`, so let's use that.

Refs: xkbcommon#305
Signed-off-by: Ran Benita <[email protected]>
bluetech added a commit that referenced this issue Apr 11, 2023
`_MSC_VER` is specific to MSVC, but there can be other compilers targeting
windows. Hopefully they do define `_WIN32`, so let's use that.

Refs: #305
Signed-off-by: Ran Benita <[email protected]>
@bluetech
Copy link
Member

The _MSC_VER -> _WIN32 change is done in #320, will be included in the next release.

@awarnke
Copy link
Author

awarnke commented Apr 13, 2023

Thank you for checking the "cc.get_argument_syntax() == 'msvc' ".
You are most likely right. If I stumble across this I'll tell you.

The _MSC_VER -> _WIN32 change looks good. Thank you for the fix!

@wismill wismill added os: Windows Windows-specific enhancement Indicates new feature requests help wanted Indicates that a maintainer wants help on an issue or pull request good first issue Indicates a good issue for first-time contributors labels May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests good first issue Indicates a good issue for first-time contributors help wanted Indicates that a maintainer wants help on an issue or pull request os: Windows Windows-specific
Projects
None yet
Development

No branches or pull requests

3 participants