Skip to content

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
Member

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.

@EdmondDantes
Copy link
Contributor Author

@Xenira Thanks!

@Xenira
Copy link
Member

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
Member

Xenira commented Jan 9, 2025

Updated the branch with clippy fixes from master #352

@Xenira Xenira merged commit a493b8b into extphprs:master Jan 9, 2025
32 checks passed
@davidcole1340 davidcole1340 mentioned this pull request Feb 6, 2025
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