libhangul / libhangul

A library to support hangul input method logic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build failure on 10.6.8: sed: -e: No such file or directory

barracuda156 opened this issue · comments

I am trying to build libhangul from the latest commit. The build fails on:

[ 72%] Generating hangul-keyboard-2.xml
cd /opt/local/var/macports/build/_opt_PPCRosettaPorts_x11_libhangul/libhangul/work/build/data/keyboards && sed -i -e '1 D' -e '/^<hangul-keyboard/D' -e '/^<\/hangul-keyboard/D' -e 's/^ *<name/ <name/' hangul-keyboard-2.name.xml
sed: -e: No such file or directory
make[2]: *** [data/keyboards/hangul-keyboard-2.xml] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 75%] Generating hangul-keyboard-2y.xml
cd /opt/local/var/macports/build/_opt_PPCRosettaPorts_x11_libhangul/libhangul/work/build/data/keyboards && sed -i -e '1 D' -e '/^<hangul-keyboard/D' -e '/^<\/hangul-keyboard/D' -e 's/^ *<name/ <name/' hangul-keyboard-2y.name.xml
sed: -e: No such file or directory
make[2]: *** [data/keyboards/hangul-keyboard-2y.xml] Error 1
[ 78%] Generating hangul-keyboard-39.xml
cd /opt/local/var/macports/build/_opt_PPCRosettaPorts_x11_libhangul/libhangul/work/build/data/keyboards && sed -i -e '1 D' -e '/^<hangul-keyboard/D' -e '/^<\/hangul-keyboard/D' -e 's/^ *<name/ <name/' hangul-keyboard-39.name.xml
sed: -e: No such file or directory
make[2]: *** [data/keyboards/hangul-keyboard-39.xml] Error 1
[ 81%] Generating hangul-keyboard-3f.xml
cd /opt/local/var/macports/build/_opt_PPCRosettaPorts_x11_libhangul/libhangul/work/build/data/keyboards && sed -i -e '1 D' -e '/^<hangul-keyboard/D' -e '/^<\/hangul-keyboard/D' -e 's/^ *<name/ <name/' hangul-keyboard-3f.name.xml
sed: -e: No such file or directory
make[2]: *** [data/keyboards/hangul-keyboard-3f.xml] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_x11_libhangul/libhangul/work/build'
make[1]: *** [data/keyboards/CMakeFiles/keyboard.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_x11_libhangul/libhangul/work/build'
[ 81%] Built target hangul
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_x11_libhangul/libhangul/work/build'
make: *** [all] Error 2

Same error with gcc-4.2 and gcc12, latest cmake.

So apparently this in Makefile.am does smth wrong:

# msgfmt으로 xml 파일을 번역하면 들여쓰기 크기가 바뀌고 같은 줄에 달린 주석
# 앞에 줄바꿈이 추가된다. 이를 방지하고자 root node와 name 부분만 별도의
# name.xml로 만들어 (msgfmt 입출력은 valid XML만 가능하므로 root node도 포함.)
# 번역한후 template과 name.xml을 병합하여 키보드 xml 파일을 생성한다.
hangul-keyboard-%.xml: hangul-keyboard-%.name.xml hangul-keyboard-%.xml.template
	sed -i -e '1 D' \
		-e '/^<hangul-keyboard/D' \
		-e '/^<\/hangul-keyboard/D' \
		-e 's/^ *<name/    <name/'  $<
	sed \
		-e '/<name>/r $<' \
		-e '/<name>/D' \
		$(srcdir)/$@.template > $@

hangul-keyboard-%.name.xml.in: hangul-keyboard-%.xml.template
	grep "xml version=" $< > $@
	grep "<hangul-keyboard" $< >> $@
	grep "<name>" $< >> $@
	grep "</hangul-keyboard" $< >> $@

hangul-keyboard-%.name.xml: hangul-keyboard-%.name.xml.in Makefile
	$(AM_V_GEN)$(MSGFMT_COMMAND) --xml --template $< -d $(top_srcdir)/po -o $@

CLEANFILES = \
	hangul-keyboard-2.xml \
	hangul-keyboard-2y.xml \
	hangul-keyboard-39.xml \
	hangul-keyboard-3f.xml \
	hangul-keyboard-32.xml \
	hangul-keyboard-3s.xml \
	hangul-keyboard-3y.xml \
	hangul-keyboard-ro.xml \
	hangul-keyboard-ahn.xml \
	$(NULL)

Using Autotools instead of Cmake, build fails on:

Makefile.am: error: required file './ChangeLog' not found

What is your OS?

Using Autotools instead of Cmake, build fails on:

Makefile.am: error: required file './ChangeLog' not found

You should run ./autogen.sh which makes ChangeLog file. But still sed might fail.

What is your OS?

This is on 10.6.8 Rosetta. I wanna update libhangul in Macports, and before that I need to make sure it builds on PPC and Intel both.

You should run ./autogen.sh which makes ChangeLog file. But still sed might fail.

@choehwanjin I did as advised, and ChangeLog error was gone. However, sed still fails, as you said:

sed -i -e '1 D' \
		-e '/^<hangul-keyboard/D' \
		-e '/^<\/hangul-keyboard/D' \
		-e 's/^ *<name/    <name/'  hangul-keyboard-39.name.xml
sed -i -e '1 D' \
		-e '/^<hangul-keyboard/D' \
		-e '/^<\/hangul-keyboard/D' \
		-e 's/^ *<name/    <name/'  hangul-keyboard-3f.name.xml
sed: -e: No such file or directory
make[3]: *** [hangul-keyboard-39.xml] Error 1
make[3]: *** Waiting for unfinished jobs....
sed: -e: No such file or directory
make[3]: *** [hangul-keyboard-3f.xml] Error 1

Any suggestions how to fix that?

@barracuda156

options of sed on MacOS works differently.
Add a '' between -i and -e

Files that applied

data/keyboards/Makefile.am
data/keyboards/CMakeLists.txt

Ref: https://stackoverflow.com/questions/16285321/more-than-one-e-in-sed-on-osx

options of sed on MacOS works differently. Add a '' between -i and -e

@OctopusET Thank you very much! That worked.

@choehwanjin @OctopusET By the way, maybe it makes sense to fix that for MacOS case here in the source code too?

If it's not breaking build of other systems, I think patch should be added.

For just giving additional information, there a fork of libhangul for Korean input method (called gureum). This might have some patches for MacOS related stuff.
https://github.com/gureum/libhangul

This problem should be fixed. I will do it.