-
Notifications
You must be signed in to change notification settings - Fork 3
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
Compile error on macOS ARM64 Apple Silicon #5
Comments
Have you tried merging #1 locally? |
Nice! wasn't aware of that pr! Didn't try yet. What I did was replace all the binary libs with rm -rf maclibs/lib/*
cp -L /opt/homebrew/lib/libhunspell-1.7.0.dylib maclibs/lib
cp -L /opt/homebrew/Cellar/libiconv/1.17/lib/libiconv.dylib maclibs/lib
cp -L /opt/homebrew/lib/libogg.dylib maclibs/lib
cp -L /opt/homebrew/lib/liblzo2.dylib maclibs/lib
cp -L /opt/homebrew/lib/libtiff.dylib maclibs/lib
cp -L /opt/homebrew/lib/liblzma.dylib maclibs/lib
cp -L /opt/homebrew/lib/libopencc.dylib maclibs/lib
cp -L /opt/homebrew/lib/libzstd.a maclibs/lib
cp -L /opt/homebrew/Cellar/libao/1.2.2/lib/libao.dylib maclibs/lib
cp -L /opt/homebrew/Cellar/ffmpeg/6.0_1/lib/libavcodec.dylib maclibs/lib
cp -L /opt/homebrew/Cellar/ffmpeg/6.0_1/lib/libavformat.dylib maclibs/lib
cp -L /opt/homebrew/Cellar/ffmpeg/6.0_1/lib/libavutil.dylib maclibs/lib
cp -L /usr/local/lib/libeb.dylib maclibs/lib
cp -L /opt/homebrew/Cellar/hunspell/1.7.2/lib/libhunspell-1.7.dylib maclibs/lib
cp -L /opt/homebrew/lib/liblzma.a maclibs/lib
cp -L /opt/homebrew/Cellar/opencc/1.1.6/lib/libopencc.dylib maclibs/lib
cp -L /opt/homebrew/lib/libswresample.4.dylib maclibs/lib
cp -L /opt/homebrew/lib/libvorbisfile.3.dylib maclibs/lib
cp -L /opt/homebrew/lib/libvorbis.dylib maclibs/lib
mkdir -p maclibs/lib/ao
cp -L /opt/homebrew/Cellar/libao/1.2.2/lib/ao/plugins-4/libmacosx.so maclibs/lib/ao Replacing x64 libs with the arm64 libs + adjusting the file names made the build compile just fine. |
@vedgy: With #1 there are compiler version errors with Xcode 15.0.1 (macos sdk 14.0); this might be related to https://stackoverflow.com/a/70778475/191246 compiler log: https://pastebin.com/2XR315fd |
Qt 5 requires C++11 or later. Qt 6 requires C++17 or later. GoldenDict does not support Qt 6 yet. Make sure to build against Qt 5. |
as mentioned in the original description, in both cases the command was the same: /opt/homebrew/Cellar/qt@5/5.15.10_1/bin/qmake "CONFIG+=release no_epwing_support sdk_no_version_check use_qtwebengine no_ffmpeg_player" QMAKE_APPLE_DEVICE_ARCHS="arm64" goldendict.pro
make -j 12 this does work fine with the |
Maybe this part of the diff in #1 is at fault: + INCLUDEPATH += /opt/homebrew/include
+ LIBS += -L/opt/homebrew/lib -framework AppKit -framework Carbon See also the pull request's changes to README.md. An extract:
|
Comparison operators for MdictParser::RecordIndex and qint64 use RecordIndex's data members shadowStartPos and shadowEndPos. The binary search in MdictParser::RecordIndex::bsearch() uses these comparison operators to find a qint64 in an ordered RecordIndex collection. The condition for a bsearch() in MdictParser::readRecordBlock() uses RecordIndex's data member endPos in place of shadowEndPos by mistake. Assignments a few lines below in readRecordBlock() confirm that this is a mistake: RecordIndex const & recordIndex = recordBlockInfos_[idx]; ... recordSize = recordIndex.shadowEndPos - i->first; ... recordInfo.recordSize = recordSize; MdictParser::RecordInfo::recordSize must be non-negative because it is used as a size. For example, in IndexedMdd::loadFile(gd::wstring const &, std::vector<char> & result): result.resize( indexEntry.recordSize ); std::vector::resize() takes an unsigned size_type argument. Passing a negative integer to it would attempt to resize to a huge size close to the maximum value of std::vector::size_type. There are two practical consequences of this mistake: 1. An affected image is never displayed in the article view. 2. GoldenDict occasionally crashes while loading an affected article. I can consistently reproduce the crash by running a Debug build of GoldenDict via GDB and loading the single article of the affected dictionary attached to goldendict#1672. The backtrace: Thread 7 "Thread (pooled)" received signal SIGSEGV, Segmentation fault. #0 in () at /usr/lib/libc.so.6 #1 in Mdx::IndexedMdd::loadFile(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::vector<char, std::allocator<char> >&) (this=0x55555639d5d0, name=L"\\OPEU4_0002.png", result=std::vector of length 1993913, capacity 1993913 = {...}) at ../mdx.cc:184 #2 in Mdx::MddResourceRequest::run() (this=0x555556c15f90) at ../mdx.cc:849 #3 in Mdx::MddResourceRequestRunnable::run() (this=0x555556c163d0) at ../mdx.cc:791 #4 in () at /usr/lib/libQt5Core.so.5 #5 in () at /usr/lib/libQt5Core.so.5 goldendict#6 in () at /usr/lib/libc.so.6 goldendict#7 in () at /usr/lib/libc.so.6 Correct the mistake in readRecordBlock() and increment the Mdict format version, because the crash goes away only after reindexing an affected dictionary. Fixes goldendict#1672
Compilation fails on macOS ARM64 M2
Compilation fails on macOS ventura 13.5 with qt 5.15.10
Qt install method: Qt installed via
brew install qt@5
Qt Version: 5.15.10_1
Xcode Version: 15.0.1
qmake:
Click for error log
The text was updated successfully, but these errors were encountered: