fplll / g6k

The General Sieve Kernel
GNU General Public License v2.0
99 stars 30 forks source link

Compile error in kernal with bootstrap.sh using #89

Closed Welkin-Totoro closed 3 years ago

Welkin-Totoro commented 3 years ago

PYTHON=python3 ./bootstrap.sh -j 1

...... running build_ext Making all in kernel make[1]: 进入目录“/opt/g6k/kernel” make all-am make[2]: 进入目录“/opt/g6k/kernel” CXX fht_lsh.lo fht_lsh.cpp: In member function 'void ProductLSH::hash_templated(const float, int32_t) [with int blocks_ = 3; int32_t = int]': fht_lsh.cpp:465:29: error: variable-sized object 'c' may not be initialized float c[multi_hash] = {0}; ^ fht_lsh.cpp: In member function 'void ProductLSH::hash_templated(const float, int32_t) [with int blocks_ = 2; int32_t = int]': fht_lsh.cpp:516:29: error: variable-sized object 'c' may not be initialized float c[multi_hash] = {0}; ^ make[2]: [fht_lsh.lo] 错误 1 make[2]: 离开目录“/opt/g6k/kernel” make[1]: [all] 错误 2 make[1]: 离开目录“/opt/g6k/kernel” make: * [all-recursive] 错误 1 Traceback (most recent call last): File "setup.py", line 134, in "Programming Language :: Python :: 3", File "/opt/g6k/g6k-env/lib/python3.6/site-packages/setuptools/init.py", line 153, in setup return distutils.core.setup(attrs) File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "setup.py", line 62, in run subprocess.check_call("make") File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command 'make' returned non-zero exit status 2.

Don't forget to activate environment each time: source ./activate This will also add the following aliases: alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true alias python=python3 alias pip="python3 -m pip"

joerowell commented 3 years ago

Can you confirm your compiler? I'm guessing you're using clang or something else: the offending line is a gcc extension (C++ doesn't natively support VLAs, but gcc does).

Welkin-Totoro commented 3 years ago

@joerowell sry, I'm not pro at this. I don't know how to specify which compiler i want to use, I just did not modify any contents in makefiles or anything else.

It's running on CentOS 7.6 with newest gcc can be installed by yum.

# yum list installed|grep gcc gcc.x86_64 4.8.5-44.el7 @base
gcc-c++.x86_64 4.8.5-44.el7 @base
libgcc.i686 4.8.5-44.el7 @base
libgcc.x86_64 4.8.5-44.el7 @base

malb commented 3 years ago

Is that actually GCC 4.8.5? You can check by typing gcc --version

Welkin-Totoro commented 3 years ago

It seems to be.

# gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) Copyright © 2015 Free Software Foundation, Inc.

joerowell commented 3 years ago

Hi @Welkin-Totoro : I've put a provisional fix on the clang-fix branch. Can you try this please? All of the build instructions are exactly the same.

Welkin-Totoro commented 3 years ago

WoW, @joerowell : It apparently works!

At the end of ops it says: copying build/lib.linux-x86_64-3.6/g6k/siever.cpython-36m-x86_64-linux-gnu.so -> g6k copying build/lib.linux-x86_64-3.6/g6k/siever_params.cpython-36m-x86_64-linux-gnu.so -> g6k

Does it means my compling is totally successful?

joerowell commented 3 years ago

Yes, this should be enough. Can you confirm that you can use the library? I.e run source activate in the directory and then run whatever Python program it was that you wanted to use.

Welkin-Totoro commented 3 years ago

According to README, I did following tests:

  1. python -m pytest returns all passed

  2. py.test --cov=g6k returns error ERROR: usage: py.test [options] [file_or_dir] [file_or_dir] [...] py.test: error: unrecognized arguments: --cov=g6k inifile: /opt/g6k/pytest.ini rootdir: /opt/g6k

  3. python ./svp_exact_find_norm.py 50 -u 60 --workers 4 --challenge-seed 0 1 2 first task in Exact-SVP (Sec 6.1) because of shoter time using. And it seems like to execute completely.

joerowell commented 3 years ago

This is now fixed as of #90.