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

vte: fix build on darwin #92907

Closed
wants to merge 1 commit into from
Closed

vte: fix build on darwin #92907

wants to merge 1 commit into from

Conversation

@marsam
Copy link
Contributor

@marsam marsam commented Jul 11, 2020

Motivation for this change

Fixes #88179

cc @ssbothwell

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

mesonFlags = lib.optionals stdenv.cc.isClang [ "-D_b_symbolic_functions=false" ];

NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
Copy link
Contributor

@jtojnar jtojnar Jul 11, 2020

What error does this fix?

Copy link
Contributor Author

@marsam marsam Jul 12, 2020

It doesn't find cstdio header:

...
[27/100] Compiling C++ object 'src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o'ypebuiltins.cc.o'
FAILED: src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o
clang++ -Isrc/25a6634@@vte-urlencode-cwd@exe -Isrc -I../src -I. -I.. -Xclang -fcolor-diagnostics -pipe -std=gnu++17 -Wall -Wextra -Wcast-align -Wempty-body -Wendif-labels -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Wfloat-equal -Wignored-qualifiers -Winvalid-pch -Wmissing-declarations -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-address-of-packed-member -Wno-missing-field-initializers -Wno-packed -Wno-switch-enum -Wno-unused-parameter -Wshadow -Wshift-negative-value -Wsign-compare -Wstrict-aliasing=2 -Wtype-limits -Wundef -Wuninitialized -Wuninitialized -Wunused -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-value -Wunused-variable -Wvla -Wwrite-strings -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fno-strict-aliasing -Wnon-virtual-dtor -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -fvisibility=hidden -Werror=format=2 -Werror=format-nonliteral -Werror=format-security -nostdlib -MD -MQ 'src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o' -MF 'src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o.d' -o 'src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o' -c ../src/urlencode.cc
../src/urlencode.cc:22:10: fatal error: 'cstdio' file not found
#include <cstdio>
         ^~~~~~~~
1 error generated.
[28/100] Compiling C++ object 'src/25a6634@@vte-2.91@sha/pty.cc.o'
In file included from ../src/pty.cc:76:
../src/glib-glue.hh:160:21: warning: private field 'm_name' is not used [-Wunused-private-field]
        char const* m_name{nullptr};
                    ^
1 warning generated.
[33/100] Compiling C++ object 'src/25a6634@@test-parser@exe/parser.cc.o'
...

I saw it being used in various expressions in nixpkgs, but I'm not sure whether is the right way to solve it

];
] ++ lib.optionals stdenv.isLinux [ systemd ];

mesonFlags = lib.optionals stdenv.cc.isClang [ "-D_b_symbolic_functions=false" ];
Copy link
Contributor

@jtojnar jtojnar Jul 11, 2020

Is this a clang or Darwin limitation? I tried building it on Linux with clang but that fails for different reason.

nix-repl> clangStdenv.cc.isClang 
true

nix-repl> :b callPackage ./pkgs/development/libraries/vte/default.nix { stdenv = clangStdenv; }
[...]
clang++ -Isrc/25a6634@@vte-urlencode-cwd@exe -Isrc -I../src -I. -I.. -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -std=gnu++17 -Wall -Wextra -Wcast-align -Wempty-body -Wendif-labels -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Wfloat-equal -Wignored-qualifiers -Winvalid-pch -Wmissing-declarations -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-address-of-packed-member -Wno-missing-field-initializers -Wno-packed -Wno-switch-enum -Wno-unused-parameter -Wshadow -Wshift-negative-value -Wsign-compare -Wstrict-aliasing=2 -Wtype-limits -Wundef -Wuninitialized -Wuninitialized -Wunused -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-value -Wunused-variable -Wvla -Wwrite-strings -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fno-strict-aliasing -Wnon-virtual-dtor -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -fvisibility=hidden -Werror=format=2 -Werror=format-nonliteral -Werror=format-security -nostdlib -MD -MQ 'src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o' -MF 'src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o.d' -o 'src/25a6634@@vte-urlencode-cwd@exe/urlencode.cc.o' -c ../src/urlencode.cc
../src/urlencode.cc:22:10: fatal error: 'cstdio' file not found
#include <cstdio>
         ^~~~~~~~
1 error generated.

This one can be fixed by including libcxx but then I get:

clang++ -Isrc/25a6634@@decoder-cat@exe -Isrc -I../src -I. -I.. -I/nix/store/ihflf79d2zddwriiahmn5qvs532c6vis-glib-2.64.3-dev/include/glib-2.0 -I/nix/store/db25f4anb3q9v9pm9pwikxhjpb387p9a-glib-2.64.3/lib/glib-2>
In file included from ../src/icu-glue.cc:20:
In file included from /nix/store/ihflf79d2zddwriiahmn5qvs532c6vis-glib-2.64.3-dev/include/glib-2.0/glib.h:32:
In file included from /nix/store/ihflf79d2zddwriiahmn5qvs532c6vis-glib-2.64.3-dev/include/glib-2.0/glib/gasyncqueue.h:32:
In file included from /nix/store/ihflf79d2zddwriiahmn5qvs532c6vis-glib-2.64.3-dev/include/glib-2.0/glib/gthread.h:34:
In file included from /nix/store/ihflf79d2zddwriiahmn5qvs532c6vis-glib-2.64.3-dev/include/glib-2.0/glib/gutils.h:433:
In file included from /nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/stdlib.h:94:
In file included from /nix/store/afghxjb159hbb8g02929hhggxcpyzqbl-gcc-9.3.0/include/c++/9.3.0/stdlib.h:36:
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:101:9: error: no member named 'div_t' in the global namespace
using ::div_t;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:102:9: error: no member named 'ldiv_t' in the global namespace
using ::ldiv_t;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:104:9: error: no member named 'lldiv_t' in the global namespace
using ::lldiv_t;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:106:9: error: no member named 'atof' in the global namespace
using ::atof;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:107:9: error: no member named 'atoi' in the global namespace
using ::atoi;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:108:9: error: no member named 'atol' in the global namespace
using ::atol;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:110:9: error: no member named 'atoll' in the global namespace
using ::atoll;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:112:9: error: no member named 'strtod' in the global namespace
using ::strtod;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:113:9: error: no member named 'strtof' in the global namespace
using ::strtof;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:114:9: error: no member named 'strtold' in the global namespace
using ::strtold;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:115:9: error: no member named 'strtol' in the global namespace
using ::strtol;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:117:9: error: no member named 'strtoll' in the global namespace
using ::strtoll;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:119:9: error: no member named 'strtoul' in the global namespace
using ::strtoul;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:121:9: error: no member named 'strtoull' in the global namespace
using ::strtoull;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:123:9: error: no member named 'rand' in the global namespace
using ::rand;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:124:9: error: no member named 'srand' in the global namespace
using ::srand;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:125:9: error: no member named 'calloc' in the global namespace
using ::calloc;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:126:9: error: no member named 'free' in the global namespace
using ::free;
      ~~^
/nix/store/39n8d83i5p2frnf576xk3rh5ij6qhh01-libc++-7.1.0/include/c++/v1/cstdlib:127:9: error: no member named 'malloc' in the global namespace
using ::malloc;
      ~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Copy link
Contributor Author

@marsam marsam Jul 12, 2020

without this, I get the following error:

...
meson.build:380: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
meson.build:380: WARNING: Consider using the built-in warning_level option instead of using "-Wextra".
meson.build:381: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
meson.build:381: WARNING: Consider using the built-in warning_level option instead of using "-Wextra".
Compiler for C supports link arguments -Wl,-Bsymbolic-functions: NO

meson.build:393:4: ERROR: Assert failed: -Wl,-Bsymbolic-functions is required but not supported

A full log can be found at /private/tmp/nix-build-vte-0.60.2.drv-0/vte-0.60.2/build/meson-logs/meson-log.txt
builder for '/nix/store/gyldjwgwcqhjn0k3wgh91a3vpvs0vqpy-vte-0.60.2.drv' failed with exit code 1
error: build of '/nix/store/gyldjwgwcqhjn0k3wgh91a3vpvs0vqpy-vte-0.60.2.drv' failed

It fails here https://gitlab.gnome.org/GNOME/vte/-/blob/0.60.2/meson.build#L383-401. I'm not familiar with meson so I assumed it was an issue with Clang.
I'm not sure about the errors you are getting, but it seems to work on Darwin.

Copy link
Contributor

@jtojnar jtojnar Jul 12, 2020

That is an issue with a linker. I would assume it is not supported by Darwin linker because it does not use ELF.

@marsam marsam closed this Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants