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
Revert "flake.nix: explicitly add libcxx as dependency" #4110
Conversation
This reverts commit 7b8ae2d.
Having both LLVM 16 and LLVM 17 libraries in a single binary is most certainly going to lead to problems. |
In my tests, #4107 doesn't make any difference (any more) and libcxx-16.0.6 is included regardless in I believe what confused me is that #4107 does make a difference in environment variables:
I assume the reason |
Your question prompted me to experiment more. I defined a proper nix package, diff --git a/flake.nix b/flake.nix
index b98612d3..fd6f3845 100644
--- a/flake.nix
+++ b/flake.nix
@@ -45,13 +45,18 @@
in
with pkgs;
{
- devShells.default = mkShell {
+ packages.default = llvmPackages_17.libcxxStdenv.mkDerivation {
+ name = "tinygo-devel";
+ src = ./.;
+ dontInstall = true;
+ dontAddExtraLibs = true;
buildInputs = [
- # These dependencies are required for building tinygo (go install).
go
+ clang
+ # These dependencies are required for building tinygo (go install).
llvmPackages_17.llvm
llvmPackages_17.libclang
- llvmPackages_17.libcxx
+ # llvmPackages_17.libcxx
# Additional dependencies needed at runtime, for building and/or
# flashing.
llvmPackages_17.lld
@@ -64,7 +69,14 @@
#gdb
#openocd
];
- shellHook= ''
+ buildPhase = ''
+ echo $NIX_LDFLAGS
+ fail
+ '';
+ };
+ devShells.default = mkShell {
+ inputsFrom = [ self.packages.${system}.default ];
+ shellHook = ''
# Configure CLANG, LLVM_AR, and LLVM_NM for `make wasi-libc`.
# Without setting these explicitly, Homebrew versions might be used
# or the default `ar` and `nm` tools might be used (which don't and then
Note that libcxx-16 is still included, but after libcxx-17, even without In conclusion, |
I got a bit further by
In total: $ git diff
diff --git a/flake.nix b/flake.nix
index b98612d3..1b51a6ca 100644
--- a/flake.nix
+++ b/flake.nix
@@ -45,13 +45,16 @@
in
with pkgs;
{
- devShells.default = mkShell {
- buildInputs = [
+ packages.default = stdenv.mkDerivation {
+ name = "tinygo-devel";
+ nativeBuildInputs = [
# These dependencies are required for building tinygo (go install).
go
+ llvmPackages_17.clang
llvmPackages_17.llvm
llvmPackages_17.libclang
llvmPackages_17.libcxx
+ llvmPackages_17.libcxxabi
# Additional dependencies needed at runtime, for building and/or
# flashing.
llvmPackages_17.lld
@@ -64,7 +67,10 @@
#gdb
#openocd
];
- shellHook= ''
+ };
+ devShells.default = mkShell {
+ inputsFrom = [ self.packages.${system}.default ];
+ shellHook = ''
# Configure CLANG, LLVM_AR, and LLVM_NM for `make wasi-libc`.
# Without setting these explicitly, Homebrew versions might be used
# or the default `ar` and `nm` tools might be used (which don't$ nix develop
$ go clean -cache && go install
$ strings /Users/a/go/bin/tinygo|rg libcxx
/nix/store/24fvc7yzrvygkzid2zr9l4brmnsk3mx9-libcxxabi-17.0.6/lib/libc++abi.1.dylib
/nix/store/vv6jrgnyi4av0wqc471y7yy9k4p8yjnc-libcxx-17.0.6/lib/libc++.1.0.dylib Alas, now both versions of $ DYLD_PRINT_LIBRARIES=1 tinygo
dyld[85866]: <no uuid> /Users/a/go/bin/tinygo
dyld[85866]: <no uuid> /nix/store/pa45hr057y8q677ic3mx3m2w147p4ghz-llvm-17.0.6-lib/lib/libLLVM.dylib
dyld[85866]: <no uuid> /nix/store/a377d66g1rgsd4vkzxdhkza5g55fkmky-zlib-1.3/lib/libz.dylib
dyld[85866]: <no uuid> /nix/store/j1f6nc90w2lj3a9ffhlh3swj09rx52vm-clang-17.0.6-lib/lib/libclang.dylib
dyld[85866]: <no uuid> /nix/store/24fvc7yzrvygkzid2zr9l4brmnsk3mx9-libcxxabi-17.0.6/lib/libc++abi.1.0.dylib
dyld[85866]: <no uuid> /nix/store/vv6jrgnyi4av0wqc471y7yy9k4p8yjnc-libcxx-17.0.6/lib/libc++.1.0.dylib
dyld[85866]: <no uuid> /nix/store/lb9b1yj8l0zqgj5f28m4k1lw9wcj8d1m-libffi-3.4.4/lib/libffi.8.dylib
dyld[85866]: <no uuid> /nix/store/knf3077k6fhm0g5qw2z51m22afzhz279-ncurses-6.4/lib/libncursesw.6.dylib
dyld[85866]: <no uuid> /nix/store/al2fcmdcsxlx9zv5nsr4464dmrypf2bk-libxml2-2.11.5/lib/libxml2.2.dylib
dyld[85866]: <no uuid> /nix/store/x622mzi1g7v7nh7zq5r8d0nxbhrg9px3-libcxxabi-16.0.6/lib/libc++abi.1.0.dylib
dyld[85866]: <no uuid> /nix/store/g5r20rs0qhcjcbf9dhbnbd9ksg0h0jmx-libiconv-50/lib/libiconv.dylib
dyld[85866]: <no uuid> /nix/store/vf7k7l7ny35g1nmninaqjbryl2xqkag5-libcxx-16.0.6/lib/libc++.1.0.dylib And $ tinygo version
Segmentation fault: 11 |
So should this PR with the revert be merged? |
Hello @eliasnaur and @aykevl just wondering if we need to merge this still? Not sure about the status. Thanks! |
I think so, the "fix" didn't make any difference to me after all. |
Ok, merging since adding libcxx doesn't seem to fix any real bug and results in noise. |
Reverts #4107
After debugging the root cause of #4107 in #4107 (comment), I'm no longer able to debug the crash and version skew. This PR reverts the "fix".
I'm very sorry for the noise, I'm pretty sure I was able to flip back and forth between working and crashing, but apparently not. If I hit this issue again, I'll be more careful in analysis.