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

texmacs: Use LLVM 17 on Darwin #373205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lions-tech
Copy link

@lions-tech lions-tech commented Jan 12, 2025

The current nixos-unstable branches uses Clang 19.1.5 on Darwin per default. This results in compilation error
"/tmp/nix-build-texmacs-2.1.4.drv-0/TeXmacs/src/Kernel/Containers/hashtree.cpp:97:14: error: no member named 'contains' in 'hashtree<K, V>'".

Things done

Use LLVM 17 on Darwin to build TeXMacs, reason above.

  • 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.

Package maintainer: @roconnor


Add a 👍 reaction to pull requests you find important.

@lions-tech lions-tech force-pushed the fix-texmacs-clang-error branch from 6e3bc7b to 1763f4c Compare January 12, 2025 14:44
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 12, 2025
@nix-owners nix-owners bot requested a review from roconnor January 12, 2025 14:48
@NixOSInfra NixOSInfra added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jan 12, 2025
@lions-tech lions-tech force-pushed the fix-texmacs-clang-error branch from 1763f4c to 81ab917 Compare January 12, 2025 15:40
The current nixos-unstable branches uses Clang 19.1.5 on Darwin per default.
This results in compilation error
"/tmp/nix-build-texmacs-2.1.4.drv-0/TeXmacs/src/Kernel/Containers/hashtree.cpp:97:14:
error: no member named 'contains' in 'hashtree<K, V>'".
@lions-tech lions-tech force-pushed the fix-texmacs-clang-error branch from 81ab917 to a63570e Compare January 12, 2025 15:54
@m1dugh m1dugh added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Jan 12, 2025
Copy link
Contributor

@paparodeo paparodeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should try not to pin -- not much uses llvm17 and it is broken on aarch64-linux currently and hopefully will be dropped in the near future.

newer llvms will detect broken code in dead code which appears what is happening here. the solution is just to delete the function as it is not used or to fix the code.

remove unused broken code
diff --git a/src/Kernel/Containers/hashtree.cpp b/src/Kernel/Containers/hashtree.cpp
index 300b175..2744d75 100644
--- a/src/Kernel/Containers/hashtree.cpp
+++ b/src/Kernel/Containers/hashtree.cpp
@@ -92,12 +92,6 @@ hashtree<K,V>::operator-> (void) {
   return rep;
 }
 
-template<class K, class V> inline hashtree<K,V> 
-hashtree<K,V>::operator[] (K key) {
-  if (*this->contains (key)) return *this->children (key);
-  else FAILED ("read-access to non-existent node requested");
-}
-  
 template<class K, class V> inline hashtree<K,V> 
 hashtree<K,V>::operator() (K key) {
   realize ();

alternatively, can fix the code though given it was previously broken there are no paths which use this and is therefore untested

fix broken function
diff --git a/src/Kernel/Containers/hashtree.cpp b/src/Kernel/Containers/hashtree.cpp
index 300b175..a36ffb4 100644
--- a/src/Kernel/Containers/hashtree.cpp
+++ b/src/Kernel/Containers/hashtree.cpp
@@ -94,7 +94,7 @@ hashtree<K,V>::operator-> (void) {
 
 template<class K, class V> inline hashtree<K,V> 
 hashtree<K,V>::operator[] (K key) {
-  if (*this->contains (key)) return *this->children (key);
+  if ((*this)->contains (key)) return (*this)->children (key);
   else FAILED ("read-access to non-existent node requested");
 }
   
fix texmacs package
diff --git a/pkgs/applications/editors/texmacs/default.nix b/pkgs/applications/editors/texmacs/default.nix
index 329c0f5a8893..4d5441d2a257 100644
--- a/pkgs/applications/editors/texmacs/default.nix
+++ b/pkgs/applications/editors/texmacs/default.nix
@@ -48,6 +48,10 @@ stdenv.mkDerivation {
     hash = "sha256-h6aSLuDdrAtVzOnNVPqMEWX9WLDHtkCjPy9JXWnBgYY=";
   };
 
+  patches = [
+    ./no-contains.diff
+  ];
+
   postPatch =
     common.postPatch
     + ''
diff --git a/pkgs/applications/editors/texmacs/no-contains.diff b/pkgs/applications/editors/texmacs/no-contains.diff
new file mode 100644
index 000000000000..0ee7e3dd3fab
--- /dev/null
+++ b/pkgs/applications/editors/texmacs/no-contains.diff
@@ -0,0 +1,17 @@
+diff --git a/src/Kernel/Containers/hashtree.cpp b/src/Kernel/Containers/hashtree.cpp
+index 300b175..2744d75 100644
+--- a/src/Kernel/Containers/hashtree.cpp
++++ b/src/Kernel/Containers/hashtree.cpp
+@@ -92,12 +92,6 @@ hashtree<K,V>::operator-> (void) {
+   return rep;
+ }
+ 
+-template<class K, class V> inline hashtree<K,V> 
+-hashtree<K,V>::operator[] (K key) {
+-  if (*this->contains (key)) return *this->children (key);
+-  else FAILED ("read-access to non-existent node requested");
+-}
+-  
+ template<class K, class V> inline hashtree<K,V> 
+ hashtree<K,V>::operator() (K key) {
+   realize ();

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux 12.approvals: 1 This PR was reviewed and approved by one reputable person 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants