Bug 256775 - lang/erlang-runtime24: (24.0.2_1) Observer crashes when built with WX option
Summary: lang/erlang-runtime24: (24.0.2_1) Observer crashes when built with WX option
Status: Closed Unable to Reproduce
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Dave Cottlehuber
Depends on:
Reported: 2021-06-22 14:06 UTC by John Parkey
Modified: 2021-07-04 12:16 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (erlang)


Note You need to log in before you can comment on or make changes to this bug.
Description John Parkey 2021-06-22 14:06:35 UTC
OS Version:
  12.2-RELEASE-p7 FreeBSD 12.2-RELEASE-p7 GENERIC  amd64

john@cooler:/usr/ports/lang/erlang-runtime24$ erl
Erlang/OTP 24 [erts-12.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace] [sharing-preserving]

* Eshell V12.0.2  (abort with ^G)

1> observer:start().
  =ERROR REPORT==== 22-Jun-2021::14:32:47.235595 ===
  WX ERROR: Could not load library: load_failed
  Failed to load NIF library 
  '/usr/local/lib/libwx_gtk3u_gl-3.1.so.5: Undefined symbol "eglGetPlatformDisplay"'
Comment 1 Dave Cottlehuber freebsd_committer 2021-06-24 11:40:11 UTC
thanks for the PR, John.

Can you clarify how your erlang was built (poudriere, make, any special make.conf tunables, any other runtime24 options enabled?)?

Did you have similar issues with 24.0, 24.0.1, or 24.0.2? or just 24.0.2_1?

I've got no trouble running it here on 12.2-RELEASE, built from latest dependencies via `make package`.
$ erl
Erlang/OTP 24 [erts-12.0.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit] [dtrace] [sharing-preserving]

Eshell V12.0.2  (abort with ^G)
ok observer:start().

A full 12.2 poudriere run is going to take a few more hours to complete here, but I'll report back with that tomorrow.

It will help if you can attach your build log. preferably a poudriere one.
Comment 2 Dave Cottlehuber freebsd_committer 2021-06-24 11:56:11 UTC

$ readelf -s /usr/local/lib/libwx_gtk3u_gl-3.1.so.5.0.0 |grep eglGetPlatformDisplay

   295: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND eglGetPlatformDisplay

> pkg which /usr/local/lib/libwx_gtk3u_gl-3.1.so.5
/usr/local/lib/libwx_gtk3u_gl-3.1.so.5 was installed by package wx31-gtk3-3.1.5

is it possible your wx dependencies aren't up to date?
Comment 3 John Parkey 2021-06-24 14:08:05 UTC
(In reply to Dave Cottlehuber from comment #2)
Hi Dave

I ran make config to set the WX option, then I just built using make.
When I run the 'readelf' and 'pkg which' commands as you suggest, I see exactly the same results as in your listing.

Is there any connection with erlang-wx?  I built this and found that it was installed for erlang-wx-,1 (or is this a red herring?).

There may be a conflict because I normally run off packages rather than ports, so this is a one-off build.  (I used to build everything with synth, but reverted to trying to live with packages for an easier life!).
Comment 4 John Parkey 2021-06-24 14:16:38 UTC
(In reply to John Parkey from comment #3)
In reply to your other question, I have only attempted with 24.0.2_1
Comment 5 Dave Cottlehuber freebsd_committer 2021-06-24 14:17:37 UTC
OK so try this:

# or where-ever your ports tree is
# I assume you have a clean, up to date git tree
$ cd /usr/ports
$ git clean -fdx
$ cd lang/erlang-runtime24
# get existing packages up to date
$ sudo pkg upgrade -r FreeBSD
# polish options as required
$ sudo make config
# ensure we have appropriate dependencies *also* up to date
$ sudo pkg install -r FreeBSD --automatic $(make build-depends-list run-depends-list | sed -E -e 's,^.+/([^/]+/[^/]+$),\1,')
$ make clean package
$ sudo make reinstall

FWIW you can cheat and use erlang-wx directly, even to connect to an OTP24 instance:

$ export PATH=/usr/local/lib/erlang/bin:$PATH
$ pkill -ilf observerl > /dev/null 2>&1
$ /usr/local/lib/erlang/bin/erl -name observerl -setcookie monster -s observer start -detached

most of the time this Just Works :-) and no need for building a custom erlang.

I highly recommend using poudriere next time, the effort once set up is easy, and the results tend to avoid issues like yours!
Comment 6 John Parkey 2021-06-24 14:37:48 UTC
(In reply to Dave Cottlehuber from comment #5)
The command:
sudo pkg install -r FreeBSD --automatic $(make build-depends-list run-depends-list | sed -E -e 's,^.+/([^/]+/[^/]+$),\1,')
gives me an error "Illegal variable name"
Comment 7 John Parkey 2021-06-24 15:51:01 UTC
Just completed the build process as you advised, but get exactly the same error as previously.
Comment 8 John Parkey 2021-06-28 11:31:12 UTC

I spent the weekend rebuilding everything under Synth.  After a lot of tracing in the erl terminal, and various research, I have finally discovered that the problem is nothing to do with the erlang port.  The error is due to the nvidia driver not supporting the egl call.

Apologies for wasting your time on this.  Please close.
Comment 9 Dave Cottlehuber freebsd_committer 2021-06-28 15:35:43 UTC
not wasted at all and I'm relieved to hear the port is fine!

FWIW I am running on an NVIDIA here without issue, maybe you just need to jump to 13.0?

- nvidia-driver 460.80
- FreeBSD 13.0-RELEASE amd64
- GeForce 1050Ti KalmX
Comment 10 John Parkey 2021-07-04 12:16:27 UTC
(In reply to Dave Cottlehuber from comment #9)
I upgraded to 13.0 (I also had to upgrade my old nvidia GT 610 as this seems to be the only card which is not supported by the new driver).
Now works correctly.