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

Windows - add a DEBUG build with debugging symbols #350

Merged

Conversation

EdmondDantes
Copy link
Contributor

This change enables the extension to be compiled correctly in debug mode.
The issue was that, in the default case, the builder attempted to use files from the PHP DEV PACK, which lacks debug symbols. This resulted in a linker error, as it couldn't find the emalloc functions (these have different signatures in DEBUG builds).

Solution:

  • Add an environment variable PHP_LIB.
  • Check if we are compiling in debug mode. If so, require this variable to be set. Otherwise, proceed as before.
  • PHP_LIB must point to a built PHP instance. The library name is chosen as php8ts_debug.lib.

P.S. I tried to find a place in the documentation to add this, but I can't figure out where it should go. If you can provide details, I would certainly include it.

@Xenira
Copy link
Collaborator

Xenira commented Jan 7, 2025

Thanks for the contribution and sorry for the delay in getting back to you.

Regarding the documentation it would probably be best to add a separate "Windows" section here as I could not find a good place to put it.

Seems like the pipeline builds are now unable to find the proper php lib. Can you have a look at that?

EDIT:

Regarding docu: Adding this to https://github.com/davidcole1340/ext-php-rs?tab=readme-ov-file#windows-requirements would probably be fine too.

@Xenira Xenira linked an issue Jan 7, 2025 that may be closed by this pull request
@EdmondDantes
Copy link
Contributor Author

@Xenira Thank you for the suggestions.

I fixed the library search function to ensure it works in all cases or returns an error.
I added a brief note that for DEBUG builds on Windows, PHP must be manually built from the SDK.

windows_build.rs Outdated Show resolved Hide resolved
@EdmondDantes
Copy link
Contributor Author

@Xenira Thanks!

@Xenira
Copy link
Collaborator

Xenira commented Jan 8, 2025

@EdmondDantes could you run cargo fmt on your changes?

@EdmondDantes
Copy link
Contributor Author

@Xenira Done

@Xenira Xenira force-pushed the feature/task-349-windows_debug_build branch from 01896e9 to e221600 Compare January 9, 2025 21:58
@Xenira
Copy link
Collaborator

Xenira commented Jan 9, 2025

Updated the branch with clippy fixes from master #352

@Xenira Xenira merged commit a493b8b into davidcole1340:master Jan 9, 2025
32 checks passed
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.

Windows - add a DEBUG build with debugging symbols.
2 participants