Closed elbrujohalcon closed 3 years ago
I'm also seeing this. Going back to 3.13.2 is working. Have not bisected further.
@rcc how were you using this feature?
@tsloughter I'm building an Erlang release for the Raspberry Pi in a Buildroot environment.
@rcc so the system libs are the same as the erts? Just not having system_libs
should work if you set include_erts
to the path. I think...
@tsloughter I'll be honest that my knowledge is a little rusty here. This is a project I built 3 years ago and was just dusting off. When I updated packages, several things broke. Here's what I think is happening.
Buildroot builds an erts and set of system_libs for the rpi. This is what the release will run on when it's on the target. The build machine is an x86 linux host (cross compilation environment). The OTP and erts versions between the host and target are not in sync. rebar3/relx is running against the host installation, so you have to set the target paths when packaging a release for the target.
Here are parts of my rebar.config.script that modify the paths. STAGING_DIR is an env variable that buildroot sets for the cross compilation environment.
%% if STAGING_DIR environment set, return a modified path to the erlang
%% system. otherwise, return the passed Default.
StagedSystemFun =
fun(Default) ->
case os:getenv("STAGING_DIR") of
false -> Default;
[] -> Default;
Dir -> lists:flatten([Dir,"/usr/lib/erlang"])
end
end.
FilterRelxFun =
fun({release, {Relname, Ver}, Apps}) ->
case ReposVer of
false -> {release, {Relname, Ver}, Apps};
[] -> {release, {Relname, Ver}, Apps};
V -> {release, {Relname, V}, Apps}
end;
({include_erts, true}) -> {include_erts, StagedSystemFun(true)};
({system_libs, true}) -> {system_libs, StagedSystemFun(true)};
(T) -> T
end.
I find that I get errors like the following if I don't also set the path for system_libs.
ERROR: architecture for "/usr/local/erlrel/lib/runtime_tools-1.12.3/priv/lib/trace_file_drv.so" is "Advanced Micro Devices X86-64", should be "ARM"
Both need to be set to the staging install.
@rcc interesting, ok, thanks. It sounds like there may be a deeper bug where the OTP for the erts dir is not used for system libs.
Looks like 3.14.0-rc1 is the first tag where it breaks.
I was looking into this and it is more complicated than I first thought.
The issue is relx no longer searches for applications itself but relies on what rebar3 tells it to use. Rebar3 doesn't read the system_libs
config option out of relx
and thus passes the currently used system libs and not ones in that directory.
I guess I need to change rebar_relx
module to check for that config option and do a new search for system libs.
According to the docs, this is a valid configuration for
relx
:But running
rebar3 tar
with that configuration, leads me to…Which comes from this
case
statement.