kakao / khaiii

Kakao Hangul Analyzer III
Apache License 2.0
1.41k stars 284 forks source link

CMake Error: The source directory "/tmp/pip-xxxx-build/khaiii-0.4" does not appear to contain CMakeLists.txt. #73

Closed IAmEnchant closed 5 years ago

IAmEnchant commented 5 years ago

python package 설치를 위해 pip3 install . 명령을 실행하면 다음과 같은 오류가 나타납니다.

user@host:~/khaiii/build/package_python$ pip3 install .
Processing /khaiii_build/khaiii/build/package_python
Installing collected packages: khaiii
  Running setup.py install for khaiii ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-478gf4ho-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bm0ekidn-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    CMake Error: The source directory "/tmp/pip-478gf4ho-build/khaiii-0.4" does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-478gf4ho-build/setup.py", line 94, in <module>
        cmdclass={'build': CustomBuild}
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-478gf4ho-build/setup.py", line 49, in run
        subprocess.check_call('cmake ..', cwd=build_dir, shell=True)
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'cmake ..' returned non-zero exit status 1.

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-478gf4ho-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bm0ekidn-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-478gf4ho-build/

사용 환경은 다음과 같습니다.

IAmEnchant commented 5 years ago

참고가 될지 모르겠지만 make package_python 실행 결과입니다.

(khaiii) user@host:~/khaiii/build$ make package_python
-- [khaiii] fused multiply add option enabled
-- [hunter] Calculating Toolchain-SHA1
-- [hunter] Calculating Config-SHA1
-- [hunter] HUNTER_ROOT: /home/user/.hunter
-- [hunter] [ Hunter-ID: 70287b1 | Toolchain-ID: f1a5aaa | Config-ID: dffbc08 ]
-- [hunter] BOOST_ROOT: /home/user/.hunter/_Base/70287b1/f1a5aaa/dffbc08/Install (ver.: 1.68.0-p1)
-- Boost version: 1.68.0
-- [hunter] CXXOPTS_ROOT: /home/user/.hunter/_Base/70287b1/f1a5aaa/dffbc08/Install (ver.: 2.1.1-pre)
-- [hunter] EIGEN_ROOT: /home/user/.hunter/_Base/70287b1/f1a5aaa/dffbc08/Install (ver.: 3.3.5)
-- [hunter] FMT_ROOT: /home/user/.hunter/_Base/70287b1/f1a5aaa/dffbc08/Install (ver.: 4.1.0)
-- [hunter] GTEST_ROOT: /home/user/.hunter/_Base/70287b1/f1a5aaa/dffbc08/Install (ver.: 1.8.0-hunter-p11)
-- [hunter] NLOHMANN_JSON_ROOT: /home/user/.hunter/_Base/70287b1/f1a5aaa/dffbc08/Install (ver.: 3.3.0)
-- [hunter] SPDLOG_ROOT: /home/user/.hunter/_Base/70287b1/f1a5aaa/dffbc08/Install (ver.: 0.16.3-p1)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/khaiii/build
Run CPack packaging tool for source...
CPack: Create package using ZIP
CPack: Install projects
CPack: - Install directory: /home/user/khaiii
CPack: Create package
CPack: - package: /home/user/khaiii/build/khaiii-0.4.zip generated.
Built target package_python
(khaiii) user@host:~/khaiii/build$ cd package_python
(khaiii) user@host:~/khaiii/build/package_python$ ls -al
total 24
drwxrwxr-x  3 user user 4096 Jul 12 01:12 .
drwxrwxr-x 10 user user 4096 Jul 12 01:12 ..
drwxrwxr-x  2 user user 4096 Jul 12 01:12 khaiii
-rw-rw-r--  1 user user   22 Jul 12 01:12 khaiii-0.4.zip
lrwxrwxrwx  1 user user   41 Jul 12 01:12 LICENSE -> /home/user/khaiii/LICENSE
-rw-rw-r--  1 user user   87 Jul 12 01:12 MANIFEST.in
lrwxrwxrwx  1 user user   43 Jul 12 01:12 README.md -> /home/user/khaiii/README.md
-rw-rw-r--  1 user user 2279 Jul 12 01:12 setup.py
(khaiii) user@host:~/khaiii/build/package_python$ file khaiii-0.4.zip
build/package_python/khaiii-0.4.zip: Zip archive data (empty)

khaiii-0.4.zip 파일이 비어있는 것으로 나옵니다.

krikit commented 5 years ago

처음 보는 현상이라 저도 원인을 짐작하기 힘드네요. 혹시 build 디렉토리에서 아래와 같이 빌드 및 테스트는 정상적으로 잘 되시는지요?

mkdir build
cd build
cmake ..
make -j
make resource
make test
IAmEnchant commented 5 years ago

테스트는 이상 없이 진행됩니다.

(khaiii) user@host:~/khaiii/build$ make test
Running tests...
Test project /home/user/khaiii/build
    Start 1: test_khaiii
1/1 Test #1: test_khaiii ......................   Passed    0.09 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.10 sec
krikit commented 5 years ago

build 디렉터리 아래에서 make package_source 명령에 의해 khaiii-0.4.zip 파일이 생성되어야 하는데요. 혹시 이 명령을 수행했을 때에는 정상적으로 파일이 생성되나요?

IAmEnchant commented 5 years ago
(khaiii) user@host:~/khaiii/build$ make package_source
Run CPack packaging tool for source...
CPack: Create package using ZIP
CPack: Install projects
CPack: - Install directory: /home/user/khaiii
CPack: Create package
CPack: - package: /home/user/khaiii/build/khaiii-0.4.zip generated.
(khaiii) user@host:~/khaiii/build$ ls -al
total 120
drwxrwxr-x 11 user user  4096 Jul 12 17:56 .
drwxrwxr-x 12 user user  4096 Jul 12 02:27 ..
drwxrwxr-x  3 user user  4096 Jul 12 02:28 _3rdParty
drwxrwxr-x  2 user user  4096 Jul 12 02:38 bin
-rw-rw-r--  1 user user 17649 Jul 12 02:28 CMakeCache.txt
drwxrwxr-x 11 user user  4096 Jul 12 02:43 CMakeFiles
-rw-rw-r--  1 user user  3917 Jul 12 02:28 cmake_install.cmake
-rw-rw-r--  1 user user  3702 Jul 12 02:28 CPackConfig.cmake
drwxrwxr-x  3 user user  4096 Jul 12 02:46 _CPack_Packages
-rw-rw-r--  1 user user  3982 Jul 12 02:28 CPackSourceConfig.cmake
-rw-rw-r--  1 user user   426 Jul 12 02:28 CTestTestfile.cmake
-rw-rw-r--  1 user user    22 Jul 12 17:56 khaiii-0.4.zip
drwxrwxr-x  2 user user  4096 Jul 12 02:36 lib
-rw-rw-r--  1 user user 36645 Jul 12 02:28 Makefile
drwxrwxr-x  3 user user  4096 Jul 12 02:46 package_python
drwxrwxr-x  3 user user  4096 Jul 12 02:44 share
drwxrwxr-x  2 user user  4096 Jul 12 02:43 test
drwxrwxr-x  3 user user  4096 Jul 12 02:46 Testing
(khaiii) user@host:~/khaiii/build$ file khaiii-0.4.zip
khaiii-0.4.zip: Zip archive data (empty)

해당 명령 또한 비어있는 zip 파일이 생성되었습니다.

krikit commented 5 years ago

make package_source 명령에 의해 소스코드가 묶여서 khaiii-0.4.zip 파일이 생성되어야 하는데, 이때도 여전히 빈 zip 파일이 생성되네요. cpack 명령어가 제대로 동작하지 않는 것인데, 이런 경우는 처음이라 잘 모르겠네요. ㅠ.ㅠ

말씀하시는 cmake 버전을 보니 ubunbu 18.04의 apt 명령은 아니고 pip 명령으로 설치하신 듯 한데 맞나요? 다행히 ubuntu 18.04에서 apt로 설치 가능한 cmake 버전이 3.10 이상이라 다음과 같이 cmake를 새로 설치한 다음 한번 해보실 수 있을까요?

# 기존 pip로 설치한 cmake 제거
pip uninstall cmake

# log off and log in

# apt 명령을 통한 cmake 설치
apt update -y
apt install cmake
IAmEnchant commented 5 years ago

알려주신 방법에도 소용 없어서 Ubuntu 19.04 환경에서 해보니 되더군요, 혹시나 하고 기존 Ubuntu 18.04 환경의 root 계정으로 해보니 또 되네요... 그래서 마지막으로 기존 계정의 ~/.hunter 디렉토리와 khaiii 디렉토리를 지우고 전부 다시 해서 성공했습니다. 원인은 모르겠지만 hunter workspace 구성에 문제가 있던 것 같습니다. 찝찝한 기분을 남기고 어정쩡하게 성공했네요.

user@host:~$ python3 test.py
안녕,   안녕/IC + ,/SP
세상.   세상/NNG + ./SF

비슷한 문제를 겪으시는 분이 생긴다면 ~/.hunter 디렉토리도 삭제해보시기 바랍니다. 신경써주셔서 감사합니다.