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

fish 3.6.0 build fails in Cygwin #9502

Closed
andrew-schulman opened this issue Jan 20, 2023 · 3 comments
Closed

fish 3.6.0 build fails in Cygwin #9502

andrew-schulman opened this issue Jan 20, 2023 · 3 comments
Labels
Milestone

Comments

@andrew-schulman
Copy link
Contributor

I'm trying to build fish 3.6.0 for Cygwin. The build fails on re.cpp.o, with cannot convert ‘PCRE2_UCHAR32*’ {aka ‘unsigned int*’} to ‘PCRE2_UCHAR16*’ {aka ‘short unsigned int*’}:

[45/118] Building CXX object CMakeFiles/fishlib.dir/src/re.cpp.o
FAILED: CMakeFiles/fishlib.dir/src/re.cpp.o
/usr/bin/g++.exe -DBINDIR=L\"/usr/bin\" -DCMAKE_BINARY_DIR=\"/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x
86_64/build\" -DCMAKE_SOURCE_DIR=\"/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0\" -DD
ATADIR=L\"/usr/share\" -DDOCDIR=L\"/usr/share/doc/fish\" -DLOCALEDIR=\"/usr/share/locale\" -DPREFIX=L\"/us
r\" -DSYSCONFDIR=L\"/etc\" -D_ATFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOUR
CE -D_REENTRANT -D_UNICODE=1 -I/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/build -Wno-comment -fdeb
ug-prefix-map=/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/build=/usr/src/debug/fish-3.6.0-1 -fdebug
-prefix-map=/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0=/usr/src/debug/fish-3.6.0-1
-Wredundant-move -O2 -g -DNDEBUG   -UNDEBUG -fdiagnostics-color=always -Wall -Wextra -Wno-comment -Wno-add
ress -fno-exceptions -std=gnu++11 -MD -MT CMakeFiles/fishlib.dir/src/re.cpp.o -MF CMakeFiles/fishlib.dir/src/re.cpp.o.d -o CMakeFiles/fishlib.dir/src/re.cpp.o -c /home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0/src/re.cpp
/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0/src/re.cpp: In member function ‘maybe_t<std::basic_string<wchar_t> > re::regex_t::substitute(const wcstring&, const wcstring&, re::sub_flags_t, size_t, re::re_error_t*, int*) const’:
/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0/src/re.cpp:254:46: error: cannot convert ‘PCRE2_UCHAR32*’ {aka ‘unsigned int*’} to ‘PCRE2_UCHAR16*’ {aka ‘short unsigned int*’}
  254 |                          replacement.size(), reinterpret_cast<PCRE2_UCHAR32 *>(buffer), &bufflen);
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                              |
      |                                              PCRE2_UCHAR32* {aka unsigned int*}
In file included from /home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0/src/re.cpp:15:
/usr/include/pcre2.h:939:1: note:   initializing argument 10 of ‘int pcre2_substitute_16(const pcre2_code_16*, PCRE2_SPTR16, size_t, size_t, uint32_t, pcre2_match_data_16*, pcre2_match_context_16*, PCRE2_SPTR16, size_t, PCRE2_UCHAR16*, size_t*)’
  939 | PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
      | ^
/home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0/src/re.cpp:273:51: error: cannot convert ‘PCRE2_UCHAR32*’ {aka ‘unsigned int*’} to ‘PCRE2_UCHAR16*’ {aka ‘short unsigned int*’}
  273 |                               replacement.size(), reinterpret_cast<PCRE2_UCHAR32 *>(&res[0]),
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   PCRE2_UCHAR32* {aka unsigned int*}
In file included from /home/ASchulma/dev/cygwin/fish/fish-3.6.0-1.x86_64/src/fish-3.6.0/src/re.cpp:15:
/usr/include/pcre2.h:939:1: note:   initializing argument 10 of ‘int pcre2_substitute_16(const pcre2_code_16*, PCRE2_SPTR16, size_t, size_t, uint32_t, pcre2_match_data_16*, pcre2_match_context_16*, PCRE2_SPTR16, size_t, PCRE2_UCHAR16*, size_t*)’
  939 | PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
      | ^

Any thoughts or suggestions? The build succeeded with fish 3.5.1.

@faho faho closed this as completed in 52d2087 Jan 21, 2023
@faho
Copy link
Member

faho commented Jan 21, 2023

string just always used PCRE2_UCHAR instead of the fixed-size PCRE2_UCHAR32.

This fails on cygwin because we're using wchar_t, which is 16 bit there, and 16 != 32 (hope I can do that without a citation).

I'm just gonna change this to UCHAR again because we've never had issues with it.

- replacement.size(), reinterpret_cast<PCRE2_UCHAR32 *>(buffer), &bufflen);
+ replacement.size(), reinterpret_cast<PCRE2_UCHAR *>(buffer), &bufflen);

@faho faho added the cygwin label Jan 21, 2023
@faho faho added this to the fish 3.6.1 milestone Jan 21, 2023
@andrew-schulman
Copy link
Contributor Author

Thanks. Confirmed that this fixes the build error, but there's one more case that needs to be fixed, in b72c3a4.

faho added a commit that referenced this issue Jan 23, 2023
See #9502

(cherry picked from commit bd871c5)
faho added a commit that referenced this issue Jan 23, 2023
@faho
Copy link
Member

faho commented Jan 23, 2023

I just added bd871c5, hope that's alright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants