Skip to content

machopatchfinder64.cpp:92:51: error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] #44

@mast3rz3ro

Description

@mast3rz3ro

Hi there!

I'm getting this error and seems that it's only happens when compiling on arm32 devices.

Log:

$ make
make  all-recursive
make[1]: Entering directory '/data/data/com.termux/files/home/utils-src/libpatchfinder'
Making all in libpatchfinder
make[2]: Entering directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder'
Making all in ibootpatchfinder
make[3]: Entering directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder/ibootpatchfinder'
make  all-am
make[4]: Entering directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder/ibootpatchfinder'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder/ibootpatchfinder'
make[3]: Leaving directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder/ibootpatchfinder'
Making all in kernelpatchfinder
make[3]: Entering directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder/kernelpatchfinder'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder/kernelpatchfinder'
make[3]: Entering directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder'
/data/data/com.termux/files/usr/bin/bash ../libtool  --tag=CXX   --mode=compile clang++ -DHAVE_CONFIG_H -I. -I..  -I../include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include  -I../include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include -g -O2 -std=c++20 -O3 -D EXPECTIONNAME=OFexception -MT libpatchfinder_la-machopatchfinder64.lo -MD -MP -MF .deps/libpatchfinder_la-machopatchfinder64.Tpo -c -o libpatchfinder_la-machopatchfinder64.lo `test -f 'machopatchfinder64.cpp' || echo './'`machopatchfinder64.cpp
libtool: compile:  clang++ -DHAVE_CONFIG_H -I. -I.. -I../include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include -I../include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/home/utils-bin/include -g -O2 -std=c++20 -O3 -D EXPECTIONNAME=OFexception -MT libpatchfinder_la-machopatchfinder64.lo -MD -MP -MF .deps/libpatchfinder_la-machopatchfinder64.Tpo -c machopatchfinder64.cpp  -fPIC -DPIC -o .libs/libpatchfinder_la-machopatchfinder64.o
machopatchfinder64.cpp:92:51: error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
   92 |             segments.push_back({_buf+seg->fileoff,seg->filesize, seg->vmaddr, (vmprot)(isWeirdPrelinkText ? (kVMPROTEXEC | kVMPROTREAD) : seg->maxprot), seg->segname});
      |                                                   ^~~~~~~~~~~~~
machopatchfinder64.cpp:92:51: note: insert an explicit cast to silence this issue
   92 |             segments.push_back({_buf+seg->fileoff,seg->filesize, seg->vmaddr, (vmprot)(isWeirdPrelinkText ? (kVMPROTEXEC | kVMPROTREAD) : seg->maxprot), seg->segname});
      |                                                   ^~~~~~~~~~~~~
      |                                                   static_cast<size_t>( )
machopatchfinder64.cpp:119:51: error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
  119 |             segments.push_back({_buf+seg->fileoff,seg->filesize, (patchfinder64::loc_t)seg->vmaddr, (vmprot)(isWeirdPrelinkText ? (kVMPROTEXEC | kVMPROTREAD) : seg->maxprot), seg->segname});
      |                                                   ^~~~~~~~~~~~~
machopatchfinder64.cpp:119:51: note: insert an explicit cast to silence this issue
  119 |             segments.push_back({_buf+seg->fileoff,seg->filesize, (patchfinder64::loc_t)seg->vmaddr, (vmprot)(isWeirdPrelinkText ? (kVMPROTEXEC | kVMPROTREAD) : seg->maxprot), seg->segname});
      |                                                   ^~~~~~~~~~~~~
      |                                                   static_cast<size_t>( )
machopatchfinder64.cpp:197:45: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
  197 |             uint32_t* kdata32 = (uint32_t*) _buf;
      |                                             ^
machopatchfinder64.cpp:195:28: note: add an explicit capture of 'this' to capture '*this' by reference
  195 |         uint8_t* tryfat = [=]() -> uint8_t* {
      |                            ^
      |                             , this
1 warning and 2 errors generated.
make[3]: *** [Makefile:584: libpatchfinder_la-machopatchfinder64.lo] Error 1
make[3]: Leaving directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder'
make[2]: *** [Makefile:603: all-recursive] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/utils-src/libpatchfinder/libpatchfinder'
make[1]: *** [Makefile:488: all-recursive] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/utils-src/libpatchfinder'
make: *** [Makefile:397: all] Error 2

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions