app-i18n/opencc sometimes fails to build with parallelization (-jX where X >= 2). It seems that multiple custom targets try to copy locally built libopencc.so.1.0.0 into the same directory, and it can fail with error 'Error copying file ".../src/libopencc.so.1.0.0" to ".../src/tools".'. Example output (with -j10): [ 78%] Building TWVariants.ocd [ 78%] Building HKVariantsPhrases.ocd [ 78%] Building JPVariants.ocd [ 78%] Building HKVariants.ocd [ 78%] Building STCharacters.ocd [ 78%] Building TSCharacters.ocd [ 78%] Building TSPhrases.ocd [ 78%] Building TWVariantsRevPhrases.ocd [ 78%] Building STPhrases.ocd cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools && /usr/bin/cmake -E cmake_link_script CMakeFiles/opencc_phrase_extract.dir/link.txt --verbose=1 cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && /usr/bin/cmake -E copy /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0 /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools /usr/bin/x86_64-pc-linux-gnu-g++ -march=corei7 -O2 -fno-ident -frecord-gcc-switches -fstack-clash-protection -mfunction-return=thunk -mindirect-branch=thunk -mindirect-branch-register -pipe -Wall -Werror=terminate -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,--gc-sections -Wl,--sort-common -Wl,-z,now -pthread -rdynamic CMakeFiles/opencc_phrase_extract.dir/PhraseExtract.cpp.o -o opencc_phrase_extract -Wl,-rpath,/var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src: ../libopencc.so.1.0.0 cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/TWVariants.txt --output TWVariants.ocd --from text --to ocd Error copying file "/var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/libopencc.so.1.0.0" to "/var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/src/tools". make[2]: *** [data/CMakeFiles/Dictionaries.dir/build.make:87: data/TSCharacters.ocd] Error 1 make[2]: *** Waiting for unfinished jobs.... cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/STCharacters.txt --output STCharacters.ocd --from text --to ocd cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/STPhrases.txt --output STPhrases.ocd --from text --to ocd cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/HKVariants.txt --output HKVariants.ocd --from text --to ocd cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/TSPhrases.txt --output TSPhrases.ocd --from text --to ocd cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/HKVariantsPhrases.txt --output HKVariantsPhrases.ocd --from text --to ocd cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/JPVariants.txt --output JPVariants.ocd --from text --to ocd cd /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build/data && ../src/tools/opencc_dict --input /var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5/data/dictionary/TWVariantsRevPhrases.txt --output TWVariantsRevPhrases.ocd --from text --to ocd make[2]: Leaving directory '/var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build' [ 78%] Built target opencc_phrase_extract make[2]: Leaving directory '/var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build' make[1]: *** [CMakeFiles/Makefile2:1196: data/CMakeFiles/Dictionaries.dir/all] Error 2 make[1]: Leaving directory '/var/tmp/portage/app-i18n/opencc-1.0.5/work/opencc-1.0.5_build' make: *** [Makefile:163: all] Error 2 * ERROR: app-i18n/opencc-1.0.5::gentoo failed (compile phase): * emake failed
Created attachment 547666 [details] opencc-1.0.5:20180923-160629.log
According to the upstream commit, it seems we don't need the copy command on Linux. I also confirmed that build pass without the copy command. https://github.com/BYVoid/OpenCC/commit/572ec0a6828331f6ab86c742a783fd57440eeabe I'll add patch to drop the command.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50be00f6ee1ce7eaa585389586a5d838e65e647b commit 50be00f6ee1ce7eaa585389586a5d838e65e647b Author: Naohiro Aota <naota@gentoo.org> AuthorDate: 2018-10-09 17:56:23 +0000 Commit: Naohiro Aota <naota@gentoo.org> CommitDate: 2018-10-09 17:57:31 +0000 app-i18n/opencc: add patch to avoid conflicting copy copy command is only necessary in VS build, and it's causing conflict on parallel build. Dropping the command is safe on Linux. Closes: https://bugs.gentoo.org/666904 Signed-off-by: Naohiro Aota <naota@gentoo.org> Package-Manager: Portage-2.3.50, Repoman-2.3.11 app-i18n/opencc/files/opencc-stop-copy.patch | 18 ++++++++++++++++++ app-i18n/opencc/opencc-1.0.5.ebuild | 7 +++++-- app-i18n/opencc/opencc-9999.ebuild | 7 +++++-- 3 files changed, 28 insertions(+), 4 deletions(-)
https://github.com/BYVoid/OpenCC/issues/322