rkdeveloptool icon indicating copy to clipboard operation
rkdeveloptool copied to clipboard

Cannot compile on macOS 26.2: errors

Open krl91 opened this issue 1 month ago • 2 comments

Hi, my mac is up to date (30/12/2025)

brew install automake autoconf libusb pkg-config git wget
git clone https://github.com/rockchip-linux/rkdeveloptool
cd rkdeveloptool

then I try according to docs.radxa.

autoreconf -i
./configure
make -j $(nproc)

and I have the following errors:

g++ -DHAVE_CONFIG_H -I. -I./cfg  -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/opt/homebrew/Cellar/libusb/1.0.29/include/libusb-1.0   -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cpp
main.cpp:2563:12: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
 2563 |         BYTE pBuf[nSectorSize * DEFAULT_RW_LBA];
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:2563:12: note: read of non-const variable 'nSectorSize' is not allowed in a constant expression
main.cpp:2562:6: note: declared here
 2562 |         int nSectorSize = 512;
      |             ^
main.cpp:2935:12: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
 2935 |         BYTE pBuf[nSectorSize * DEFAULT_RW_LBA];
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:2935:12: note: read of non-const variable 'nSectorSize' is not allowed in a constant expression
main.cpp:2934:6: note: declared here
 2934 |         int nSectorSize = 512;
      |             ^
2 errors generated.
make[1]: *** [main.o] Error 1
make: *** [all-recursive] Error 1```

krl91 avatar Dec 30 '25 09:12 krl91

Same problem for me. It won't compile. I have same errors you are posting. I followed the instructions listed on the armbian.com website (Documentation --> Getting Started --> Rockchip). I am on an MBA M4 macOS 15.7.2 Sequoia. Everything up-to-date. Any info appreciated.

mpuk2000 avatar Jan 03 '26 14:01 mpuk2000

Same here. Someone knows how to solve?

posixx avatar Jan 03 '26 15:01 posixx

Same issue, can't compile...

litingfeng avatar Jan 06 '26 20:01 litingfeng

I asked claude to help me; use this:

CXXFLAGS="-Wno-vla-cxx-extension" ./configure make -j $(nproc)

posixx avatar Jan 06 '26 21:01 posixx

I asked claude to help me; use this:

CXXFLAGS="-Wno-vla-cxx-extension" ./configure make -j $(nproc)

This did not work for me. I also asked Claude, and this is what I got, and it did work on macOS. I added the 'const' declaration to the two lines in main.cpp, and then used 'make' without the -j flag.

(FROM CLAUDE:) Two issues here:

1. nproc doesn't exist on macOS - that's a Linux command. Use sysctl -n hw.ncpu instead, or just make without the -j flag.

2. The actual compile errors - Clang is treating variable-length arrays (VLAs) as errors because the code declares int nSectorSize = 512 then uses it to size an array. C++ requires compile-time constants for array sizes.

Quick fix - edit main.cpp and change both occurrences (lines 2562 and 2934) from:

int nSectorSize = 512;

to:

const int nSectorSize = 512;

Then run make again.


Alternatively, you could disable that specific warning by editing the Makefile and removing -Werror from CXXFLAGS, but the const fix is cleaner since the value genuinely is constant.

mpuk2000 avatar Jan 07 '26 08:01 mpuk2000

That was really helpful, thanks @mpuk2000.

r1chjames avatar Jan 07 '26 20:01 r1chjames

2934

Thanks, that works for me too. Hopefully they will quickly implement this correction on GitHub to solve the issue.

krl91 avatar Jan 09 '26 22:01 krl91

I've just created a fork with this quick fix: https://github.com/krl91/rkdeveloptool/. Hopefully it will become obsolete soon. In case you need it, I have also created a release for macOS arm64: https://github.com/krl91/rkdeveloptool/releases/tag/v0.1.0-alpha.

krl91 avatar Jan 09 '26 22:01 krl91

rkdevtool build on macos

You have just to build it with GCC rather than with CLang (the default compiler on MacOS):

#Install necessary tools
brew install automake autoconf libusb pkg-config git wget gcc

#Clone rkdevtool
git clone https://github.com/rockchip-linux/rkdeveloptool`

#Build it with gcc (You will get an error with CLang)
cd rkdeveloptool
autoreconf -i
CXX=/opt/homebrew/bin/g++-15 ./configure
make
cp rkdeveloptool /opt/homebrew/bin/

BastienVigneron avatar Jan 12 '26 17:01 BastienVigneron