armoha / euddraft

System for pluginizing eudplib codes.
Other
29 stars 4 forks source link

[epScript] Missing libepScriptLib.so #91

Open zuhanit opened 1 year ago

zuhanit commented 1 year ago

It seems there's only libepScriptLib.dll exists but .so and .dylib isn't. Is it intended? I'm using Arch Linux on WSL 2.

OSError: ***/eudplib/epscript/libepScriptLib.so: cannot open shared object file: No such file or directory

armoha commented 1 year ago

You can build your own libepScriptLib.so using CMake and C++ compiler with https://github.com/armoha/eudplib/blob/master/eudplib/epscript/cpp/CMakeLists.txt

armoha commented 1 year ago

Following https://int-i.github.io/cpp/2020-08-09/github-actions-boost/ , https://gist.github.com/NickNaso/0d478f1481686d5bcc868cac06620a60 and other articles, I tried adding github actions for building libepScriptLib.so in https://github.com/armoha/eudplib/commit/26a2134db63eb7ba46f7079f00601db1d77ef487 , but failed with error: /bin/sh: 1: ./lemon2: Exec format error I guess https://github.com/armoha/eudplib/blob/master/eudplib/epscript/cpp/lemon2 is not linux executable but macOS (OS X) binary? Probably @phu54321 would know. I don't have linux machine to test this so feel free to open PR for github workflow yaml.

  cd eudplib/epscript/cpp
  cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -Wno-dev 
  cmake --build build -j 2 --config Release
  shell: /usr/bin/bash -e {0}
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- pybind11 v2.10.0 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3.6") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
release mode - static linked
-- Configuring done
-- Generating done
-- Build files have been written to: /home/runner/work/eudplib/eudplib/eudplib/epscript/cpp/build
[  1%] Generating /home/runner/work/eudplib/eudplib/eudplib/epscript/cpp/parser/epparser.cpp, /home/runner/work/eudplib/eudplib/eudplib/epscript/cpp/parser/epparser.h
[  2%] Generating /home/runner/work/eudplib/eudplib/eudplib/epscript/cpp/parser/epparser.cpp, /home/runner/work/eudplib/eudplib/eudplib/epscript/cpp/parser/epparser.h
/bin/sh: 1: ./lemon2: Exec format error
make[2]: *** [CMakeFiles/pyepScript.dir/build.make:75: /home/runner/work/eudplib/eudplib/eudplib/epscript/cpp/parser/epparser.cpp] Error 2
make[1]: *** [CMakeFiles/Makefile2:131: CMakeFiles/pyepScript.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/bin/sh: 1: ./lemon2: Exec format error
make[2]: *** [CMakeFiles/epScriptLib.dir/build.make:75: /home/runner/work/eudplib/eudplib/eudplib/epscript/cpp/parser/epparser.cpp] Error 2
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/epScriptLib.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Error: Process completed with exit code 2.
phu54321 commented 1 year ago

uh just compile https://github.com/armoha/eudplib/blob/master/eudplib/epscript/cpp/lemon2.c

gcc lemon2.c -o lemon2
zuhanit commented 1 year ago

I don't know about CMake or C++, anyway I tried to build following commands. But il fails... :(

cd eudplib/epscript/cpp
gcc lemon2.c -o lemon2
mkdir build && cd build
cmake ..
make
// cmake ..
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/sbin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/sbin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- pybind11 v2.10.0 
-- Found PythonInterp: /usr/sbin/python3 (found suitable version "3.10.8", minimum required is "3.6") 
-- Found PythonLibs: /usr/lib/libpython3.10.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zuhanit/Programming/eudplib/eudplib/epscript/cpp/build
// make
[  1%] Generating /home/zuhanit/Programming/eudplib/eudplib/epscript/cpp/parser/epparser.cpp, /home/zuhanit/Programming/eudplib/eudplib/epscript/cpp/parser/epparser.h
CMake Error: cmake version 3.24.2
Usage: cmake -E <command> [arguments...]
Available commands: 
  capabilities              - Report capabilities built into cmake in JSON format
  cat [--] <files>...       - concat the files and print them to the standard output
  chdir dir cmd [args...]   - run command in a given directory
  compare_files [--ignore-eol] file1 file2
                              - check if file1 is same as file2
  copy <file>... destination  - copy files to destination (either file or directory)
  copy_directory <dir>... destination   - copy content of <dir>... directories to 'destination' directory
  copy_if_different <file>... destination  - copy files if it has changed
  echo [<string>...]        - displays arguments as text
  echo_append [<string>...] - displays arguments as text but no new line
  env [--unset=NAME ...] [NAME=VALUE ...] [--] <command> [<arg>...]
                            - run command in a modified environment
  environment               - display the current environment
  make_directory <dir>...   - create parent and <dir> directories
  md5sum <file>...          - create MD5 checksum of files
  sha1sum <file>...         - create SHA1 checksum of files
  sha224sum <file>...       - create SHA224 checksum of files
  sha256sum <file>...       - create SHA256 checksum of files
  sha384sum <file>...       - create SHA384 checksum of files
  sha512sum <file>...       - create SHA512 checksum of files
  remove [-f] <file>...     - remove the file(s), use -f to force it (deprecated: use rm instead)
  remove_directory <dir>... - remove directories and their contents (deprecated: use rm instead)
  rename oldname newname    - rename a file or directory (on one volume)
  rm [-rRf] [--] <file/dir>... - remove files or directories, use -f to force it, r or R to remove directories and their contents recursively
  sleep <number>...         - sleep for given number of seconds
  tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]
                            - create or extract a tar or zip archive
  time command [args...]    - run command and display elapsed time
  touch <file>...           - touch a <file>.
  touch_nocreate <file>...  - touch a <file> but do not create it.
  create_symlink old new    - create a symbolic link new -> old
  create_hardlink old new   - create a hard link new -> old
  true                      - do nothing with an exit code of 0
  false                     - do nothing with an exit code of 1

make[2]: *** [CMakeFiles/epScriptLib.dir/build.make:77: /home/zuhanit/Programming/eudplib/eudplib/epscript/cpp/parser/epparser.cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/epScriptLib.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
armoha commented 1 year ago

Now I remembered, before using MSVC, updating GCC in mingw32 caused build failure so I had to use MinGW-w64 with GCC 6.4.0 to build epScript successfully in 2019. Maybe GCC or linux version is related here.

zuhanit commented 1 year ago

Finally, I renamed epparser.c to epparser.cpp and add #include <cstring> in parserUtils.cpp and it works to build libepScript.so file. Yes I know it is something like fool approach 🤣