Skip to content

squeak: fix build#358156

Merged
emilazy merged 1 commit intoNixOS:masterfrom
infinisil:fix/squeak
Nov 25, 2024
Merged

squeak: fix build#358156
emilazy merged 1 commit intoNixOS:masterfrom
infinisil:fix/squeak

Conversation

@infinisil
Copy link
Member

@infinisil infinisil commented Nov 22, 2024

Fixes the squeak build for ZHF (#352882) by switching to LLVM 17, because LLVM 18 is broken because clang doesn't support -export-dynamic anymore. It looks like -rdynamic should work, but I don't quite know how to patch it nicely. Ping @ehmry as the package maintainer.

Build: https://hydra.nixos.org/build/267872600
Broken since the switch to LLVM 18 in #312981

This is the bi-yearly demo fix for the #ZurichZHF Hackathon! 🎉

Things done

  • Built on x86_64-linux
  • Ran a squeak image successfully

This work is funded by Tweag and Antithesis

Add a 👍 reaction to pull requests you find important.

@infinisil infinisil added 0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign backport release-24.11 labels Nov 22, 2024
@infinisil infinisil requested a review from a user November 22, 2024 14:38
@paparodeo
Copy link
Contributor

it looks like -export-dynamic is being passed erroneously to the compiler, as it is a linker flag and at this step the build is just compiling notice the -c flag.

clang -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2 -DCOGMTVM=0 -Wall -pthread -DLSB_FIRST=1 -m64 -Wno-missing-braces -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable  -m64  -L/usr/local/lib -Wl,-z,now   -export-dynamic -c -o disabledPlugins.o disabledPlugins.c
clang: error: unknown argument: '-export-dynamic'
clang: warning: -Wl,-z,now: 'linker' input unused [-Wunused-command-line-argument]

just removing the -export-dynamic flag from the compilation step should suffice and thus will not need to pin the compiler.

remove -export-dynamic from compilation step
diff --git a/pkgs/development/compilers/squeak/cc-no-export-dynamic.diff b/pkgs/development/compilers/squeak/cc-no-export-dynamic.diff
new file mode 100644
index 000000000000..d4a1047d80d5
--- /dev/null
+++ b/pkgs/development/compilers/squeak/cc-no-export-dynamic.diff
@@ -0,0 +1,20 @@
+diff --git a/platforms/unix/config/make.prg.in b/platforms/unix/config/make.prg.in
+index 96a64a1..05f6114 100644
+--- a/platforms/unix/config/make.prg.in
++++ b/platforms/unix/config/make.prg.in
+@@ -8,13 +8,13 @@ o		= .o
+ a		= .a
+ x		=
+ COMPILE		= $(CC) $(CFLAGS) $(CPPFLAGS) $(XCFLAGS) \
+-		  $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) -export-dynamic -c -o
++		  $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) -c -o
+ COMPILEIFP	= $(CC) $(CFLAGS) $(XCFLAGS) \
+ 		  $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) -export-dynamic -fno-omit-frame-pointer -c -o
+ CXXFLAGS	= $(CFLAGS) # Hack; can't be bothered to add CXXFLAGS to the configure mess
+ COMPILE.cpp = $(COMPILE.cc)
+ COMPILE.cc	= $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(XCFLAGS) \
+-		  $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) -export-dynamic -c -o
++		  $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) -c -o
+ LINK		= $(LIBTOOL) --mode=link \
+ 		  $(CC) $(CFLAGS) $(XCFLAGS) \
+ 		  $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) -export-dynamic -o
diff --git a/pkgs/development/compilers/squeak/default.nix b/pkgs/development/compilers/squeak/default.nix
index 0494539c4435..9e3c1cfe0d8c 100644
--- a/pkgs/development/compilers/squeak/default.nix
+++ b/pkgs/development/compilers/squeak/default.nix
@@ -135,6 +135,7 @@ in stdenv.mkDerivation {
     ./squeak-configure-version.patch
     ./squeak-plugins-discovery.patch
     ./squeak-squeaksh-nixpkgs.patch
+    ./cc-no-export-dynamic.diff
   ];
 
   postPatch = ''

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages 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. labels Nov 23, 2024
@infinisil
Copy link
Member Author

@paparodeo Thank you, it works!

@ofborg ofborg bot requested a review from a user November 24, 2024 23:52
@emilazy emilazy changed the title squeak: fix build by switching to llvm 17 stdenv squeak: fix build Nov 25, 2024
@emilazy emilazy merged commit 9437ab6 into NixOS:master Nov 25, 2024
@github-actions
Copy link
Contributor

Successfully created backport PR for release-24.11:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign 10.rebuild-darwin: 0 This PR does not cause any packages 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.

3 participants