go-gl / glfw

Go bindings for GLFW 3
BSD 3-Clause "New" or "Revised" License
1.56k stars 182 forks source link

fix _GNU_SOURCE redefined warning #356

Closed cornelk closed 2 years ago

cornelk commented 2 years ago

Closes #351

In upstream the _GNU_SOURCE and poll changes introduced this:

https://github.com/glfw/glfw/commit/9f73e9afa34b1c0902023d5d80be1c0f954135e5 https://github.com/glfw/glfw/commit/adc202d2c3182ca6ad8344624941e56d8e0bc493

Jacalz commented 2 years ago

You might want to contribute this change upstream. I'm not sure modifying the Glfw source in this way is the best option. It will be removed as soon as Glfw is updated again.

cornelk commented 2 years ago

@Jacalz this has already been fixed in upstream (i guess for 3.4): https://github.com/glfw/glfw/commit/bb9d699ae66b2bdc8718995ba13c57c9c8e59602 - I am not sure what to do here

Jacalz commented 2 years ago

I think it would be best to get a PR up to fix the issue for their next 3.3.x release. Otherwise it's just going to be undone work when we update to the next release in that series.

That would mean targeting the 3.3-stable branch: https://github.com/glfw/glfw/tree/3.3-stable.

cornelk commented 2 years ago

@Jacalz I have a feeling that this will not get accepted ( https://github.com/glfw/glfw/issues/2133#issuecomment-1162311920 ) but I will submit it there

dmitshur commented 2 years ago

@cornelk I think what I wrote in https://github.com/go-gl/glfw/issues/351#issuecomment-1126811178 applies. If the problem can be reproduced with the GLFW C source code (independently of the Go bindings), then it's reasonable to target the fix there. The report in glfw/glfw#2133 refers to the Go bindings, which is suboptimal for that issue tracker. We should investigate that on our side in #351.

cornelk commented 2 years ago

@Jacalz i believe i have found the proper fix now by changing the import order, i see no warning anymore (i am on Linux) using:

cd v3.3/glfw/
go clean -cache
go build ./...

@dmitshur thanks for the tip, i checked and could build glfw 3.3 stable without any warning.

Jacalz commented 2 years ago

Cool. Nice work 👍

dmitshur commented 2 years ago

Thanks.