Bug 265109 - lang/julia: Fails to run: ERROR: Unable to find compatible target in system image.
Summary: lang/julia: Fails to run: ERROR: Unable to find compatible target in system i...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Daniel Engberg
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-07-09 09:54 UTC by Alexey Vyskubov
Modified: 2022-09-11 18:50 UTC (History)
4 users (show)

See Also:
rizor.reardon: maintainer-feedback+
rizor.reardon: merge-quarterly?


Attachments
Patch for lang/julia (101.41 KB, patch)
2022-07-12 14:52 UTC, Eric Reardon
rizor.reardon: maintainer-approval+
Details | Diff
Updated patch for lang/julia (101.36 KB, patch)
2022-08-05 15:01 UTC, Eric Reardon
rizor.reardon: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Vyskubov 2022-07-09 09:54:47 UTC
with the current package:

❯ julia
ERROR: Unable to find compatible target in system image.

The port is broken as well, for example, does not install cert.pem or libz.so.1.

❯ uname -a
FreeBSD och.pentode.fi 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64
Comment 1 Eric Reardon 2022-07-09 19:15:18 UTC
(In reply to Alexey Vyskubov from comment #0)

Sorry but i can't reproduce, julia is working fine for me.

I have seen bug's like this related to cpuid ether not detecting the uarch or julia not supporting a particular uarch, can you tell me what uarch you are using.

Also the FreeBSD port of julia is using the libz in FreeBSD, but i will look into cert.pem
Comment 2 Alexey Vyskubov 2022-07-10 19:42:58 UTC
(In reply to Eric Reardon from comment #1)
You cannot reproduce because julia is compiled with support for your cpu instead of generic. Julia is the only thing that does not work.

What is uarch and how do I determine it?

❯ doas cpuid
 eax in    eax      ebx      ecx      edx
00000000 0000000b 756e6547 6c65746e 49656e69
00000001 00030678 02100800 41d8e3bf bfebfbff
00000002 61b3a001 0000ffc2 00000000 00000000
00000003 00000000 00000000 00000000 00000000
00000004 1c000121 0140003f 0000003f 00000001
00000005 00000040 00000040 00000003 33000020
00000006 00000007 00000002 00000009 00000000
00000007 00000000 00002282 00000000 00000000
00000008 00000000 00000000 00000000 00000000
00000009 00000000 00000000 00000000 00000000
0000000a 07280203 00000000 00000000 00004503
0000000b 00000001 00000001 00000100 00000002
80000000 80000008 00000000 00000000 00000000
80000001 00000000 00000000 00000101 28100800
80000002 20202020 6e492020 286c6574 43202952
80000003 72656c65 52286e6f 50432029 4e202055
80000004 30343832 20402020 36312e32 007a4847
80000005 00000000 00000000 00000000 00000000
80000006 00000000 00000000 04008040 00000000
80000007 00000000 00000000 00000000 00000100
80000008 00003024 00000000 00000000 00000000

Vendor ID: "GenuineIntel"; CPUID level 11

Intel-specific functions:
Version 00030678:
Type 0 - Original OEM
Family 6 - Pentium Pro
Model 55 - 
Stepping 8
Reserved 0

Feature flags set 2 (CPUID.01H:ECX): 41d8e3bf:
SSE3     SSE3 extensions
PCLMULDQ PCLMULDQ instruction
DTES64   64-bit debug store
MONITOR  MONITOR/MWAIT instructions
DS-CPL   CPL Qualified Debug Store
VMX      Virtual Machine Extensions
EST      Enhanced Intel SpeedStep Technology
TM2      Thermal Monitor 2
SSSE3    Supplemental Streaming SIMD Extension 3
CX16     CMPXCHG16B
xTPR     Send Task Priority messages
PDCM     Perfmon and debug capability
SSE4.1   Streaming SIMD Extension 4.1
SSE4.2   Streaming SIMD Extension 4.2
MOVBE    MOVBE instruction
POPCNT   POPCNT instruction
TSC-Deadline
RDRAND   RDRAND Instruction

Extended feature flags set 1 (CPUID.80000001H:EDX): 28100800
SYSCALL   SYSCALL/SYSRET instructions
XD-bit    Execution Disable bit
RDTSCP    RDTSCP and IA32_TSC_AUX are available
EM64T     Intel Extended Memory 64 Technology

Extended feature flags set 2 (CPUID.80000001H:ECX): 00000101
LAHF      LAHF/SAHF available in IA-32e mode
8 - unknown feature

Old-styled TLB and cache info:
a0: unknown TLB/cache descriptor
b3: Data TLB: 4-KB Pages, 4-way set associative, 128 entries
61: unknown TLB/cache descriptor
c2: unknown TLB/cache descriptor
ff: CPUID leaf 2 does not report full information, query leaf 4

Processor serial: 0003-0678-0000-0000-0000-0000

Deterministic Cache Parameters:
index=0: eax=1c000121 ebx=0140003f ecx=0000003f edx=00000001
> Data cache, level 1, self initializing
> 64 sets, 6 ways, 1 partitions, line size 64
> full size 24576 bytes
> NB this package has up to 8 threads
index=1: eax=1c000122 ebx=01c0003f ecx=0000003f edx=00000001
> Instruction cache, level 1, self initializing
> 64 sets, 8 ways, 1 partitions, line size 64
> full size 32768 bytes
index=2: eax=1c00c143 ebx=03c0003f ecx=000003ff edx=00000001
> Unified cache, level 2, self initializing
> 1024 sets, 16 ways, 1 partitions, line size 64
> full size 1048576 bytes
> shared between up to 4 threads

Structured feature flags CPUID.07H.00H:EBX: 00002282:
IA32_TSC_ADJUST MSR
SMEP
Enhanced REP MOVSB/STOSB
Deprecates FPU CS and FPU DS

Regarding libz: here is the behavior with the latest port:

(I have removed ~/.julia and added FFMPEG)

julia> import FFMPEG
[ Info: Precompiling FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a]
ERROR: LoadError: InitError: could not load library "/home/alexey/.julia/artifacts/68256e02e4a4b00bc95486fd61b4bc5c7348760c/lib/libfreetype.so"
Shared object "libz.so.1" not found, required by "libfreetype.so"
Stacktrace:
[blah]


What do I miss?
Comment 3 Eric Reardon 2022-07-11 00:30:45 UTC
(In reply to Alexey Vyskubov from comment #2)

I used the package from FreeBSD pkg to test the problem not my own port and if removing ~/.julia fixed the first error then the problem was probably some sort of corruption in ~/.julia instead of uarch detection.

As to zlib and other bundled lib's some of julia's package's are linked to the bundled lib's but FreeBSD's
policy is to avoid bundled lib's https://docs.freebsd.org/en/books/porters-handbook/special/#bundled-libs so your options going forward are either to use BinaryBuilder.jl https://github.com/JuliaPackaging/BinaryBuilder.jl to replace those dependence's or use the stock version of julia https://julialang.org/downloads/ or wait for me add support for julia's app's and module's to FreeBSD port's.
Comment 4 Alexey Vyskubov 2022-07-11 08:38:45 UTC
(In reply to Eric Reardon from comment #3)
Removing ~/.julia fixed nothing. I did it to illustrate zlib problem in port. The package does not work at all.
Comment 5 Alexey Vyskubov 2022-07-11 08:38:56 UTC
(In reply to Eric Reardon from comment #3)
Removing ~/.julia fixed nothing. I did it to illustrate zlib problem in port. The package does not work at all.
Comment 6 Alexey Vyskubov 2022-07-11 09:07:10 UTC
I am happy to inform you that the binary FreeBSD build from the Julia website:
- runs, unlike the current FreeBSD package;
- does not fail at precompiling stuff, unlike the current FreeBSD port.
Thank you for the pointer!
Comment 7 Eric Reardon 2022-07-12 14:52:01 UTC
Created attachment 235219 [details]
Patch for lang/julia

I was able to reproduce the error on older computer i had,
this patch fixes the error for me and adds the missing cert.pem.

Patch passes portlint and poudriere,
please merge to quarterly branch.
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2022-07-12 15:30:28 UTC
Instead of using native perhaps you use CPUTYPE variable as this is globally used in FreeBSD and for ports.

https://cgit.freebsd.org/src/tree/share/examples/etc/make.conf#n25
Comment 9 Eric Reardon 2022-07-12 19:45:00 UTC
(In reply to Daniel Engberg from comment #8)
Sorry but CPUTYPE does not seem to work,
i ran it as ${CPUTYPE} and CPUTYPE but the build failed each time with 
ERROR: Invalid CPU name "CPUTYPE".
Comment 10 Eric Reardon 2022-08-05 15:01:47 UTC
Created attachment 235694 [details]
Updated patch for lang/julia

Updating patch after https://cgit.freebsd.org/ports/commit/?id=f98ae56653d5255e3519da4e97d6edbaa7e6df91
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-09-11 18:49:33 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6f2b881f6fcf3d35f33368511f85dc07662c6b2c

commit 6f2b881f6fcf3d35f33368511f85dc07662c6b2c
Author:     Eric Reardon <rizor.reardon@yahoo.com>
AuthorDate: 2022-09-11 18:15:33 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2022-09-11 18:48:31 +0000

    lang/julia: Fix runtime issue

    * Disable automatic optimization as this causes runtime issues if CPU
    instructions are not available.
    * Install certificate

    PR:             265109
    Reported by:    Alexey Vyskubov <alexey@ocaml.nl>

 lang/julia/Makefile  | 11 ++++++++---
 lang/julia/pkg-plist |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)
Comment 13 Daniel Engberg freebsd_committer freebsd_triage 2022-09-11 18:50:20 UTC
Committed with some minor changes, sorry for the wait