Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundlex: error creating symlink when priv directory exists #718

Closed
gBillal opened this issue Jan 24, 2024 · 2 comments
Closed

Bundlex: error creating symlink when priv directory exists #718

gBillal opened this issue Jan 24, 2024 · 2 comments
Assignees
Labels

Comments

@gBillal
Copy link

gBillal commented Jan 24, 2024

Bundlex creates symbolic links for the plugins to the precompiled libraries. However the link is pointing to non-existing folder if the project has a priv directory. Elixir uses symlink for the priv directory inside _build which leads to errors like this

Bundlex: Building natives: decoder, encoder
** (File.LinkError) could not create symlink from "../../../../bundlex/priv/shared/precompiled/httpsgithub.comBtbNFFmpeg-Buildsreleasesdownloadlatestffmpeg-n6.1-latest-linux64-gpl-shared-6.1.tar.xz/lib" to "/home/xxxxx/p/OpenSourceProjects/elixir/membrane/membrane_h264_ffmpeg_plugin/_build/dev/lib/membrane_h264_ffmpeg_plugin/priv/bundlex/nif/httpsgithub.comBtbNFFmpeg-Buildsreleasesdownloadlatestffmpeg-n6.1-latest-linux64-gpl-shared-6.1.tar.xz": file already exists
    (elixir 1.15.4) lib/file.ex:666: File.ln_s!/2
    (bundlex 1.4.5) lib/bundlex/toolchain/common/unix/os_deps.ex:266: Bundlex.Toolchain.Common.Unix.OSDeps.create_relative_symlink/3
    (bundlex 1.4.5) lib/bundlex/toolchain/common/unix/os_deps.ex:137: Bundlex.Toolchain.Common.Unix.OSDeps.get_precompiled_libs_flags/4
    (bundlex 1.4.5) lib/bundlex/toolchain/common/unix/os_deps.ex:129: Bundlex.Toolchain.Common.Unix.OSDeps.resolve_os_dep_provider/3
    (bundlex 1.4.5) lib/bundlex/toolchain/common/unix/os_deps.ex:84: Bundlex.Toolchain.Common.Unix.OSDeps.resolve_os_dep/5
    (elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
    (bundlex 1.4.5) lib/bundlex/toolchain/common/unix/os_deps.ex:12: Bundlex.Toolchain.Common.Unix.OSDeps.resolve_os_deps/1
    (bundlex 1.4.5) lib/bundlex/native.ex:115: Bundlex.Native.resolve_native/4

Or

Bundlex: Building natives: decoder
Compiling 5 files (.ex)

00:35:57.082 [error] Bundlex cannot load nif :decoder of app :membrane_h264_ffmpeg_plugin
from "/home/xxxxx/p/OpenSourceProjects/elixir/membrane/membrane_h264_ffmpeg_plugin/_build/dev/lib/membrane_h264_ffmpeg_plugin/priv/bundlex/nif/decoder", check bundlex.exs file for information about nifs.
Reason: :load_failed, Failed to load NIF library /home/xxxx/p/OpenSourceProjects/elixir/membrane/membrane_h264_ffmpeg_plugin/_build/dev/lib/membrane_h264_ffmpeg_plugin/priv/bundlex/nif/decoder: 'libavcodec.so.60: cannot open shared object file: No such file or directory'
@mat-hek mat-hek self-assigned this Jan 29, 2024
@mat-hek mat-hek added this to Smackore Jan 29, 2024
@mat-hek mat-hek moved this to Todo in Smackore Jan 29, 2024
@mat-hek mat-hek added the bug label Jan 29, 2024
@varsill varsill self-assigned this Feb 8, 2024
@varsill varsill moved this from Todo to In Progress in Smackore Feb 8, 2024
@varsill varsill moved this from In Progress to In Review in Smackore Feb 12, 2024
@varsill
Copy link
Contributor

varsill commented Feb 15, 2024

Hello @gBillal! I think release v1.4.6 should solve this problem.
#closed by membraneframework/bundlex#122

@varsill varsill closed this as completed Feb 15, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in Smackore Feb 15, 2024
@gBillal
Copy link
Author

gBillal commented Feb 19, 2024

After this fix, there's no issue on building a project with priv folder, however when creating a release there's an error when trying to copy the content of the wrong symlink generated by bundlex since Elixir doesn't seem to copy the content of the symlink but where the symlink points

16:51:00.018 [error] Task #PID<0.22827.0> started from #PID<0.99.0> terminating
** (File.CopyError) could not copy recursively from "/xxxx/_build/dev/lib/native/priv" to "/xxx/_build/dev/rel/project/lib/native-0.9.1/priv". /xxx/apps/bundlex/priv/shared/precompiled/httpsgithub.comBtbNFFmpeg-Buildsreleasesdownloadlatestffmpeg-n6.1-latest-linux64-gpl-shared-6.1.tar.xz/lib: no such file or directory
    (elixir 1.15.4) lib/file.ex:949: File.cp_r!/3
    (mix 1.15.4) lib/mix/release.ex:828: anonymous fn/4 in Mix.Release.copy_app/2
    (elixir 1.15.4) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.15.4) lib/mix/release.ex:825: Mix.Release.copy_app/2
    (elixir 1.15.4) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
    (elixir 1.15.4) lib/task/supervised.ex:36: Task.Supervised.reply/4
Function: &:erlang.apply/2
    Args: [#Function<0.65334452/1 in Mix.Tasks.Release.assemble/1>, [:native]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants