Skip to content

btanks: fix build on linux#390986

Merged
K900 merged 1 commit intoNixOS:staging-nextfrom
LordGrimmauld:btanks-fix
Mar 19, 2025
Merged

btanks: fix build on linux#390986
K900 merged 1 commit intoNixOS:staging-nextfrom
LordGrimmauld:btanks-fix

Conversation

@LordGrimmauld
Copy link
Contributor

@LordGrimmauld LordGrimmauld commented Mar 18, 2025

commit 7aeac03 (PR #386495) dropped libX11 and libGLU from propagatedBuildInputs in SDL_compat, and #389106 pointed SDL to SDL_compat, which broke this build

Hydra fail: https://hydra.nixos.org/build/292729441

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

commit 7aeac03 (PR NixOS#386495) dropped libX11 and libGLU from propagatedBuildInputs in SDL_compat, and NixOS#389106 pointed SDL to SDL_compat, which broke this build

Hydra fail: https://hydra.nixos.org/build/292729441
@LordGrimmauld LordGrimmauld added the 0.kind: build failure A package fails to build label Mar 18, 2025
@LordGrimmauld
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 390986


x86_64-linux

✅ 1 package built:
  • btanks

@grimmauld-bot
Copy link

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 390986


aarch64-linux

✅ 1 package built:
  • btanks

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Mar 18, 2025
@JohnRTitor
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 390986

Logs: https://github.com/JohnRTitor/nixpkgs-review-gha/actions/runs/13930804118


x86_64-linux

✅ 1 package built:
  • btanks

aarch64-linux

✅ 1 package built:
  • btanks

x86_64-darwin

❌ 1 package failed to build:
  • btanks

aarch64-darwin

❌ 1 package failed to build:
  • btanks

@drupol
Copy link
Contributor

drupol commented Mar 18, 2025

Broken on Darwin ?

@LordGrimmauld
Copy link
Contributor Author

LordGrimmauld commented Mar 18, 2025

checking whether the C compiler works... no

Huh? What is going on here? And i am also fairly certain the SDL changes did not cause this specific darwin break.

@JohnRTitor
Copy link
Member

configure: error: in '/nix/var/nix-build-smpeg-0.4.5.drv-0/source':
2025-03-18T18:33:55.3170400Z smpeg> configure: error: C compiler cannot create executables

@emilazy

@reckenrode
Copy link
Contributor

I have a fix for smpeg in #391118, but btanks requires non-trivial work to build on Darwin. This is where I got before I decided it wasn’t worth the effort.

  1. Apply the following patch, which abuses code injections to fix SCons. The configure check is failing to find SDL because the signature it’s using for main is wrong. It needs to be int main(int argc, char* argv) not void main(void);
  2. Set CXXFLAGS to -std=c++03 -x objective-c++; and
  3. Make X11 conditional on not-Darwin, and remove whatever is trying to link librt, which doesn’t exist on Darwin.
diff -ur a/SConstruct b/SConstruct
--- a/SConstruct	2025-03-18 19:31:49.308650714 -0400
+++ b/SConstruct	2025-03-18 19:31:32.077240927 -0400
@@ -129,7 +129,7 @@
 	conf.env.Append(LINKFLAGS = ['/SUBSYSTEM:WINDOWS', '/FORCE'])
 	conf.env.Append(LIBS=['SDLmain'])
 
-if not conf.CheckLibWithHeader('SDL', 'SDL.h', 'c++', "SDL_Init(0);", False):
+if not conf.CheckLibWithHeader('SDL', 'SDL.h"\nint main(int argc, char* argv[]) {/*', 'c++', "*/SDL_Init(0);", False):
 	Exit(1)
 	
 
@@ -140,10 +140,10 @@
 	smpeg_lib = 'smpeg_d'
 Export('smpeg_lib')
 
-if not conf.CheckLibWithHeader(smpeg_lib, 'smpeg/smpeg.h', 'c++', "SMPEG_new_data(malloc(42), 42, NULL, 0);", False):
+if not conf.CheckLibWithHeader(smpeg_lib, 'smpeg/smpeg.h"\nint main(int argc, char* argv[]) {/*', 'c++', "*/ SMPEG_new_data(malloc(42), 42, NULL, 0);", False):
 	Exit(1)
 
-if not conf.CheckLibWithHeader('SDL_image', 'SDL_image.h', 'c++', "IMG_Load(0);", False):
+if not conf.CheckLibWithHeader('SDL_image', 'SDL_image.h"\nint main(int argc, char* argv[]) {/*', 'c++', "*/IMG_Load(0);", False):
 	Exit(1)
 
 if not conf.CheckLibWithHeader('vorbisfile', 'vorbis/vorbisfile.h', 'c++', "ov_open(0, 0, 0, 0);", False):

@LordGrimmauld LordGrimmauld changed the title btanks: fix build btanks: fix build on linux Mar 19, 2025
@K900 K900 merged commit 484c7fd into NixOS:staging-next Mar 19, 2025
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.kind: build failure A package fails to build 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants