bulid on macos M3
Distribution
bulid on macos M3
Architecture
macos Apple M3 Max
Kernel version
No response
IMSProg version
v1.5.3, origin/main, origin
Bug description
when building for mac os, you will get this error
bash-3.2$ cmake .. -- The C compiler identification is AppleClang 17.0.0.17000013 -- The CXX compiler identification is AppleClang 17.0.0.17000013 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /opt/homebrew/bin/pkg-config (found version "2.4.3") -- Checking for module 'libusb-1.0' -- Found libusb-1.0, version 1.0.28 -- Configuring done (0.8s) -- Generating done (0.1s) -- Build files have been written to: /Users/users/devel/IMSProg/IMSProg_programmer/build
make -jnproc
dialogsfdp.cpp:76:18: error: no matching function for call to 'SPI_CONTROLLER_Read_NByte' 76 | retval = SPI_CONTROLLER_Read_NByte(sfdpBuf.get(),3,SPI_CONTROLLER_SPEED_SINGLE);
IMSProg/IMSProg_programmer/dialogsfdp.cpp:83:27: error: type 'std::shared_ptr<uint8_t[]>' (aka 'shared_ptr<unsigned char[]>') does not provide a subscript operator 83 | jedecMan = sfdpBuf[0]; ...... .....
Steps to reproduce
No response
Expected behavior
No response
Additional information
No response
Hello, @kurbatovmax! This is very strange. These libraries are included in the header file. Please add the following lines to dialogsfdp.cpp:
extern "C" {
#include "ch341a_spi.h"
#include "spi_controller.h"
}
- after the line
#include <QDebug>.
Hello, @kurbatovmax! This is very strange. These libraries are included in the header file. Please add the following lines to
dialogsfdp.cpp:extern "C" { #include "ch341a_spi.h" #include "spi_controller.h" }
- after the line
#include <QDebug>.
thanks for the help, but I still get errors when building.
bash-3.2$ make
[ 0%] Built target IMSProg_autogen_timestamp_deps
[ 2%] Automatic MOC and UIC for target IMSProg
[ 2%] Built target IMSProg_autogen
[ 4%] Building CXX object CMakeFiles/IMSProg.dir/mainwindow.cpp.o
/Users/maximk/devel/IMSProg/IMSProg_programmer/mainwindow.cpp:189:35: error: no matching constructor for initialization of 'std::shared_ptr<uint8_t[]>' (aka 'shared_ptr<unsigned char[]>')
189 | std::shared_ptr<uint8_t[]> buf(new uint8_t[step]);
| ^ ~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3654:23: note: candidate constructor not viable: no known conversion from 'uint8_t *' (aka 'unsigned char *') to 'nullptr_t' (aka 'std::nullptr_t') for 1st argument
3654 | _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
| ^ ~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3668:5: note: candidate constructor not viable: no known conversion from 'uint8_t *' (aka 'unsigned char *') to 'const shared_ptr<unsigned char[]>' for 1st argument
3668 | shared_ptr(const shared_ptr& __r) _NOEXCEPT;
| ^ ~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3676:5: note: candidate constructor not viable: no known conversion from 'uint8_t *' (aka 'unsigned char ') to 'shared_ptr<unsigned char[]>' for 1st argument
3676 | shared_ptr(shared_ptr&& __r) _NOEXCEPT;
| ^ ~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3656:18: note: candidate template ignored: requirement 'is_convertible<unsigned char , unsigned char ()[]>::value' was not satisfied [with _Yp = uint8_t]
3656 | explicit shared_ptr(_Yp __p,
| ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3671:9: note: candidate template ignored: could not match 'shared_ptr<_Yp>' against 'uint8_t *' (aka 'unsigned char *')
3671 | shared_ptr(const shared_ptr<_Yp>& __r,
| ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3677:52: note: candidate template ignored: could not match 'shared_ptr<_Yp>' against 'uint8_t *' (aka 'unsigned char ')
3677 | template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r,
| ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3681:34: note: candidate template ignored: could not match 'weak_ptr<_Yp>' against 'uint8_t ' (aka 'unsigned char ')
3681 | template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r,
| ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3696:9: note: candidate template ignored: could not match 'unique_ptr<_Yp, _Dp>' against 'uint8_t ' (aka 'unsigned char ')
3696 | shared_ptr(unique_ptr<_Yp, _Dp>&&,
| ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3705:9: note: candidate template ignored: could not match 'unique_ptr<_Yp, _Dp>' against 'uint8_t ' (aka 'unsigned char ')
3705 | shared_ptr(unique_ptr<_Yp, _Dp>&&,
| ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3652:23: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
3652 | _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
| ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3664:26: note: candidate constructor template not viable: requires 2 arguments, but 1 was provided
3664 | template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
| ^ ~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3666:51: note: candidate constructor template not viable: requires 2 arguments, but 1 was provided
3666 | template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, element_type __p) _NOEXCEPT;
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3659:9: note: candidate constructor template not viable: requires at least 2 arguments, but 1 was provided
3659 | shared_ptr(_Yp __p, _Dp __d,
| ^ ~~~~~~~~~~~~~~~~~~
3660 | typename enable_if<is_convertible<_Yp, element_type>::value, __nat>::type = __nat());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3665:40: note: candidate constructor template not viable: requires 3 arguments, but 1 was provided
3665 | template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:3662:9: note: candidate constructor template not viable: requires at least 3 arguments, but 1 was provided
3662 | shared_ptr(_Yp __p, _Dp __d, _Alloc __a,
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3663 | typename enable_if<is_convertible<_Yp, element_type>::value, __nat>::type = __nat());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/maximk/devel/IMSProg/IMSProg_programmer/mainwindow.cpp:197:24: error: no matching function for call to 'snor_read_param'
197 | res = snor_read_param(buf.get(), curBlock * step, step, step, currentAddr4bit);
| ^~~~~~~~~~~~~~~
/Users/maximk/devel/IMSProg/IMSProg_programmer/snorcmd_api.h:22:5: note: candidate function not viable: cannot convert argument of incomplete type 'element_type ' (aka 'unsigned char ()[]') to 'unsigned char *' for 1st argument; dereference the argument with *
22 | int snor_read_param(unsigned char *buf, unsigned long from, unsigned long len, unsigned int sector_size, unsigned int addr4b);
| ^ ~~~~~~~~~~~~~~~~~~
/Users/maximk/devel/IMSProg/IMSProg_programmer/mainwindow.cpp:200:22: error: no matching function for call to 'ch341readEEPROM_param'
200 | res = ch341readEEPROM_param(buf.get(), curBlock * step, step, currentChipSize, currentPageSize, currentAlgorithm);//currentAlgorithm);
| ^~~~~~~~~~~~~~~~~~~~~
/Users/maximk/devel/IMSProg/IMSProg_programmer/ch341a_i2c.h:368:9: note: candidate function not viable: cannot convert argument of incomplete type 'element_type ' (aka 'unsigned char ()[]') to 'uint8_t *' (aka 'unsigned char *') for 1st argument; dereference the argument with *
368 | int32_t ch341readEEPROM_param(uint8_t *buffer, uint32_t offset, uint32_t bytestoread, uint32_t ic_size, uint32_t block_size, uint8_t algorithm);
| ^ ~~~~~~~~~~~~~~~
/Users/maximk/devel/IMSProg/IMSProg_programmer/mainwindow.cpp:205:22: error: no matching function for call to 'Read_EEPROM_3wire_param'
205 | res = Read_EEPROM_3wire_param(buf.get(), static_cast
In my system (Linux mint 21) used
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
You have the
-- The C compiler identification is AppleClang 17.0.0.17000013
-- The CXX compiler identification is AppleClang 17.0.0.17000013
I realize the problem is here, but I don't know how to fix it today.....
@kurbatovmax please provide more information on your system. If you don't know how to then run this in Terminal:
system_profiler SPSoftwareDataType SPHardwareDataType |grep -e Chip -e "Model Name" -e "System Version"
system_profiler SPSoftwareDataType SPHardwareDataType |grep -e Chip -e "Model Name" -e "System Version" System Version: macOS 15.4 (24E248) Model Name: MacBook Pro Chip: Apple M3 Max
@kurbatovmax, пожалуйста, предоставьте больше информации о вашей системе. Если вы не знаете, как это сделать, запустите это в Терминале:
system_profiler SPSoftwareDataType SPHardwareDataType |grep -e Chip -e "Model Name" -e "System Version"
system_profiler SPSoftwareDataType SPHardwareDataType |grep -e Chip -e "Model Name" -e "System Version" System Version: macOS 15.4 (24E248) Model Name: MacBook Pro Chip: Apple M3 Max
the projects build fine on Intel based mac running Sequoia 15.5. i'm still trying to find a M machine so please bear with me.
Собрал под MacOS, работает
сборка через жопу, конечно, много ругалось на Qt@5, libusb, победить правильными методами не получилось, пришлось просто кинуть /opt/homebrew/Cellar/libusb/1.0.28/include/libusb-1.0/libusb.h в папку где происходит сборка (в build).
А ещё надо делать по шагам что написано внутри build.sh , либо исправлять его добавляя туда копирование libusb.h и исполнение последнего сmake из под sudo
Но всё получилось, 24c16 туда-сюда пишет-стирает (автоопределение конечно же не работает), с 25Qxx периодически вываливается ошибка
хз пока что это, но тоже случалось и с консольными утилитами, притом, программатор зависает (RUN светится постоянно)
Шрифты дурацкие, но жить можно
@kpbicka
24с16и не должна автоматом определяться, т.к. это не предусмотрено самой микросхемой.
25Qxx периодически вываливается ошибка
- С регистрами разбирались (Пункт меню
Программатор->Информ. о МС) ? Здесь есть по русски с картинками. - Прошиваете, случайно, не через прищепку?
С регистрами не смотрел, честно говоря, так глубоко не копал никогда. Прошиваю через панельку SOP16 TO DIP16
А вообще, появление GUI-шного софта для MacOS это чудо) спасибо за труд)
@kpbicka , установленный BP4 в единичку приводит к подобным ошибкам при чтении...
@kpbicka Это было на любом яблочном кремниевом компьютере (M1,M2,M3,...) или Intel ?
@kpbicka Это было на любом яблочном кремниевом компьютере (M1,M2,M3,...) или Intel ?
Это всё на Apple Silicon ((M1,M2,M3,...). На интеле у меня тоже есть, но там не проверял.
Yes, Its was checked on Apple Silicon ((M1,M2,M3,...)
@kpbicka , установленный BP4 в единичку приводит к подобным ошибкам при чтении...
Ну вот например. Несколько чипов 25 прочекал - что-то все ведут себя одинаково - ошибка чтения блока 0 или 32 бывает; при этом, как Вы указали, в регистрах нули
ну либо я что-то не так делаю, документация открыта, но чтение затянулось
Я использую переводчика, поэтому, если вы сможете говорить по -английски, было бы лучше.
Я попытался удаленно с кем -то с яблочным кремнием, и он жаловался на QT5, но у меня не было достаточно времени для правильных устранения неполадок, можете ли вы обновить руководство MacOS для установки Apple Silicon?
это может быть проблемой от brew что он не добавляет qt5 в PATH
А хотя всё же нашёлся нормальный с SFDP
но и он после перезаписи регистра в 0 тоже выдал ошибку чтения (блок 42)
@kpbicka , все это очень странно и похоже на плохо работающий драйвер. Под Linux я прошивал и считывал очень много разных микросхем. Перед выходом каждой новой версии устраиваю большой тест...
Я использую переводчика, поэтому, если вы сможете говорить по -английски, было бы лучше.
Я попытался удаленно с кем -то с яблочным кремнием, и он жаловался на QT5, но у меня не было достаточно времени для правильных устранения неполадок, можете ли вы обновить руководство MacOS для установки Apple Silicon?
I am technical engineer, not programmer. And in the process of searching for a solution to the problem, many technical forums were read and many console commands were executed that did not solve the problem, and which command was correct can no longer be found. However, I can write several solution options that I did:
brew reinstall libusb
echo 'export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/qt@5/lib"
export CPPFLAGS="-I/opt/homebrew/opt/qt@5/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig"
and here is my modified build_all.sh
#!/bin/bash
if [[ "$EUID" -ne 0 ]] && [[ "$OSTYPE" != "darwin"* ]]
then echo "Please run as root! (sudo ./build_all.sh)"
exit
fi
[[ "$OSTYPE" == "darwin"* ]] && export C_INCLUDE_PATH=/usr/local/opt/libusb/include
(
cd IMSProg_programmer
rm -rf build/
mkdir build/
cp /opt/homebrew/Cellar/libusb/1.0.28/include/libusb-1.0/libusb.h ./
cmake -S . -B build/
cmake --build build/ --parallel
sudo cmake --install build/
rm -rf build/
)
(
cd IMSProg_editor
rm -rf build/
mkdir build/
cp /opt/homebrew/Cellar/libusb/1.0.28/include/libusb-1.0/libusb.h ./
cmake -S . -B build/
cmake --build build/ --parallel
sudo cmake --install build/
rm -rf build/
)
# Reloading the USB rules or creating the app bundles for macOS
[[ "$OSTYPE" != "darwin"* ]] && udevadm control --reload-rules || sudo ./create_macos_appbundles.sh
@kpbicka , все это очень странно и похоже на плохо работающий драйвер. Под Linuz я прошивал и считывал очень много разных микросхем. Перед выходом каждой новой версии устраиваю большой тест...
С китайскими друзьями может быть всё что угодно). Обычно, я понижаю скорость и это всегда помогало, но тут это не вариант) С драйвером, да, можно поковыряться, потому что SNANDer тоже глючит
SNANDer-v.1.7.9/MacOSX/SNANDer.aarch64 -r test_snander.bin
SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.9 by McMCC <[email protected]>
Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0x40, dev_id = 0x16, dev_id_2 = 0x16
SPI NAND Flash Not Detected!
spi device id: c8 40 16 c8 40 (4016c840)
Detected SPI NOR Flash: GD25Q32, Flash Size: 4 MB
READ:
Read addr = 0x0000000000000000, len = 0x0000000000400000
libusb: warning [darwin_transfer_status] transfer error: timed out
cb_out: error: LIBUSB_TRANSFER_TIMED_OUT
ch341a_spi_send_command: Failed to write 67683 bytes
libusb: warning [darwin_abort_transfers] aborting all transactions on interface 0 pipe 1
libusb: warning [darwin_abort_transfers] aborting all transactions on interface 0 pipe 1
libusb: warning [darwin_abort_transfers] aborting all transactions on interface 0 pipe 1
Read 100% [18446744073708044287] of [18446744073709551615] bytes
Elapsed time: 34 seconds
Status: BAD(-1)
а как тут в форматировании многострочный код выделять? ))) ааа нашёл))
@kpbicka , недавно Anime4000 портировал IMSProg на Windows, и там я также обнаружил проблемы с чтением/записью SPI (25Qxxx).
@kpbicka , все это очень странно и похоже на плохо работающий драйвер
Ну окей) обновление китайского "официального" CH34xVCPDriver c 1.8 на Version 1.9 (7) не помогла) работаем дальше)
Ну, вобщем, проблема локализована. Смена USB-порта решила проблему чтения. Почему-то задние порты USB3.1 на самом Mac ведут себя странно - в программе это видно как блоки начинают читаться всё медленнее и затем чтение невозможно и вылазит ошибка. Переключение через любой хаб решает проблему.
И снова автора благодарю за удобный инструмент.
А ещё сочетание Cmd+Q вызывает Database Editor, хотя на Маках принято что Cmd+Q - это закрытие любого приложения (Quit). Ну и может шрифты как нибудь бы поправить на что-то более стандартное и покрупнее
А ещё сочетание Cmd+Q вызывает Database Editor
- в Windows и Linux - CTRL+X - выход (eXit). Поскольку в основном рассчитываю на Linux-пользователей - переделывать не буду.
I've modified the scrip to allow building with different revisions of libusb from homebrew and to fix the QT5 dependency issue:
#!/bin/bash
if [[ "$EUID" -ne 0 ]] && [[ "$OSTYPE" != "darwin"* ]]
then echo "Please run as root! (sudo ./build_all.sh)"
exit
fi
[[ "$OSTYPE" == "darwin"* ]] && export PATH="/opt/homebrew/opt/qt@5/bin:$PATH" && export C_INCLUDE_PATH=/opt/homebrew/opt/libusb:/opt/homebrew/include
(
cd IMSProg_programmer
rm -rf build/
mkdir build/
echo "STEP 1"
cmake -S . -B build/
echo "STEP 2"
cmake --build build/ --parallel
echo "STEP 3 - password needed"
sudo cmake --install build/
rm -rf build/
)
(
cd IMSProg_editor
rm -rf build/
mkdir build/
echo "STEP 4"
cmake -S . -B build/
echo "STEP 5"
cmake --build build/ --parallel
echo "STEP 6 - password needed"
sudo cmake --install build/
rm -rf build/
)
# Reloading the USB rules or creating the app bundles for macOS
[[ "$OSTYPE" != "darwin"* ]] && udevadm control --reload-rules || echo "STEP 7" && ./create_macos_appbundles.sh
iirc the /opt directory is only available pre macOS 10.15 and after that since apple started mounting system as an apfs image you either have to disable SIP completely or add it in synthetic.conf.
If you are having trouble the qt5 check if your brew path is actually added to your PATH.
To fix your brew PATH if you are using the default zsh shell then run the following
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
Then restart your shell.
This will work for 10.15+
And please don't sudo when installing. If you need to sudo then you did something wrong and messed up your file permissions.
Check this issue for what can happen and how to fix it.
https://github.com/bigbigmdm/IMSProg/issues/147
You're correct that qt5 is missing on $PATH. It should be part of the installation steps (and honestly part of the cask).
The build script was ran on macOS Sequoia 10.5. Disabling SIP was not needed and, for most people, it should always remain on.
Since the cmake -install command (that I have installed) will write to /usr/local/bin/, it will need elevated permissions on this macOS version. Can't speak for all the other versions or user configurations though.
I chose the easy way around this with sudo. None of the issues from #147 happened. Database update works fine, application launches without issues.
The correct way (that I can think of) would be to modify CMakeLists.txt by adding the set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "/new/path/ option to an output folder that doesn't require elevated permissions.
The create_macos_appbundles.sh script would also need to be modified to point to the new output directory.
during the installation of homebrew it changes the permissions on /usr/local/ to USER:admin, so yes unless you used homebrew to install the dependencies you'll need to sudo the install.
The correct way (that I can think of) would be to modify ....
this might be a better way all together to avoid any permission conflict; however, it will break running from terminal unless added to PATH and i dont like editing PATH willy-nilly.
The create_macos_appbundles.sh .....
the output is /Applications no need to change that, but if the location of the binaries is changed then that must be reflected in the app bundles.
are you running a Mx machine or Intel? @jamartinezm
sudo cmake --install build/ ... sudo cmake --install build/
никто моим изменениям значения так и не придал а они ведь позволяют собрать правильно ...
А ещё я скачиваю последний релиз 1.6.2 но в результате собирается 1.5.3 )
Не знаю, где Вы его скачиваете, в релизе с тегом 1.6.2 файл dialogabout.cpp содержит номер версии 1.6.2. Только что специально посмотрел. В ветке main лежит недоделанная версия 1.7.1 с поддержкой spi nand flash.