cocoa-xu / ExPTY

Fork pseudoterminals in Elixir
Apache License 2.0
18 stars 0 forks source link

Compilation failure #4

Closed lawik closed 1 year ago

lawik commented 1 year ago

Wanted to try the smartcell but hti a compilation error. Tried with and without the ref in install.

Mix.install([{:expty, github: "cocoa-xu/ExPTY", ref: "2a12973d3101e076da4b47c210ed7ea67a1108aa"}, :kino])
[100%] Linking CXX shared library expty.so
/usr/bin/ld: /home/lawik/.cache/mix/installs/elixir-1.14.2-erts-13.0.4/7aec4b5b0b492db22f8bc8fe7bf63f63/_build/dev/lib/expty/libuv/lib/libuv_a.a(process.c.o): warning: relocation against `__environ@@GLIBC_2.2.5' in read-only section `.text'
/usr/bin/ld: /home/lawik/.cache/mix/installs/elixir-1.14.2-erts-13.0.4/7aec4b5b0b492db22f8bc8fe7bf63f63/_build/dev/lib/expty/libuv/lib/libuv_a.a(core.c.o): relocation R_X86_64_PC32 against symbol `environ@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
gmake[3]: *** [CMakeFiles/expty.dir/build.make:97: expty.so] Error 1
gmake[3]: Leaving directory '/home/lawik/.cache/mix/installs/elixir-1.14.2-erts-13.0.4/7aec4b5b0b492db22f8bc8fe7bf63f63/_build/dev/lib/expty/cmake_expty'
gmake[2]: *** [CMakeFiles/Makefile2:85: CMakeFiles/expty.dir/all] Error 2
gmake[2]: Leaving directory '/home/lawik/.cache/mix/installs/elixir-1.14.2-erts-13.0.4/7aec4b5b0b492db22f8bc8fe7bf63f63/_build/dev/lib/expty/cmake_expty'
gmake[1]: *** [Makefile:136: all] Error 2
gmake[1]: Leaving directory '/home/lawik/.cache/mix/installs/elixir-1.14.2-erts-13.0.4/7aec4b5b0b492db22f8bc8fe7bf63f63/_build/dev/lib/expty/cmake_expty'
make: *** [Makefile:35: /home/lawik/.cache/mix/installs/elixir-1.14.2-erts-13.0.4/7aec4b5b0b492db22f8bc8fe7bf63f63/_build/dev/lib/expty/priv/expty.so] Error 2
could not compile dependency :expty, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile expty", update it with "mix deps.update expty" or clean it with "mix deps.clean expty"

It also logs this which unfortunately didn't help as those packages are installed:

** (Mix.Error) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. If you are using
Ubuntu or any other Debian-based system, install the packages
"build-essential". Also install "erlang-dev" package if not
included in your Erlang/OTP version. If you're on Fedora, run
"dnf group install 'Development Tools'".

    (mix 1.14.2) lib/mix.ex:513: Mix.raise/2
    (elixir_make 0.7.6) lib/elixir_make/compiler.ex:53: ElixirMake.Compiler.compile/1
    (mix 1.14.2) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
    (mix 1.14.2) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.14.2) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
    (mix 1.14.2) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
    (mix 1.14.2) lib/mix/tasks/compile.all.ex:33: Mix.Tasks.Compile.All.run/1
    #cell:setup:1: (file)
cocoa-xu commented 1 year ago

Hi @lawik, it should be fixed in the latest commit! :)

I added -fPIC to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS when compiling libuv.

lawik commented 1 year ago

Works!