# Julia on DragonflyBSD

**URL:** <https://discourse.julialang.org/t/julia-on-dragonflybsd/127826>\
**Category:** New to Julia\
**Created:** [April 8, 2025, 3:00am UTC](https://discourse.julialang.org/t/julia-on-dragonflybsd/127826 "2025-04-08T03:00:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohamad\_Badiez](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamad_badiez/32/213635_2.png) [@Mohamad\_Badiez](https://discourse.julialang.org/u/Mohamad_Badiez)\
**Post date:** [April 8, 2025, 3:00am UTC](https://discourse.julialang.org/t/julia-on-dragonflybsd/127826/1 "2025-04-08T03:00:58Z")

</div>

Hi everybody,

I’m trying to install Julia on DragonflyBSD from the source.

I installed gcc, fortran, OpenBLAS, and SuiteSparse on DragonflyBSD with no problem.

Now, I got this error at the end of the `gmake` process:

```julia
gcc -march=native -mtune=native -m64 -o build/libblastrampoline.o -g -O2 -std=gnu99 -fPIC -DLIBRARY_EXPORTS -D_GNU_SOURCE -DARCH_x86_64 -DF2C_AUTODETECTION -DCBLAS_DIVERGENCE_AUTODETECTION -DCOMPLEX_RETSTYLE_AUTODETECTION -c libblastrampoline.c
libblastrampoline.c: In function 'init':
libblastrampoline.c:514:23: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'RAND_MAX'?
         char curr_lib[PATH_MAX];
                       ^ ~~~~~~~
                       RAND_MAX
libblastrampoline.c:514:23: note: each undeclared identifier is reported only once for each function it appears in
gmake[2]: *** [Makefile:47: build/libblastrampoline.o] Error 1
gmake[1]: *** [/julia/deps/blastrampoline.mk:18: scratch/blastrampoline-b127bc8dd4758ffc064340fff2aef4ead552f386/build-compiled] Error 2
gmake: *** [Makefile:86: julia-deps] Error 2
root@:/julia #

```

What should I do? Thank you.

---

<div class="post-metadata">

**Author:** ![Mohamad\_Badiez](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamad_badiez/32/213635_2.png) [@Mohamad\_Badiez](https://discourse.julialang.org/u/Mohamad_Badiez)\
**Post date:** [April 8, 2025, 4:13am UTC](https://discourse.julialang.org/t/julia-on-dragonflybsd/127826/2 "2025-04-08T04:13:06Z")

</div>

I got this error:

```julia

gmake[3]: *** [Makefile.L3:4718: sgemm_small_kernel_tt_SKYLAKEX.o] Error 1
gmake[2]: *** [Makefile:204: libs] Error 1
\033[33;1m ***Clean the OpenBLAS build with 'make -C deps clean-openblas'. Rebuild with 'make OPENBLAS_USE_THREAD=0' if OpenBLAS had trouble linking libpthread.so, and with 'make OPENBLAS_TARGET_ARCH=NEHALEM' if there were errors building SandyBridge support. Both these options can also be used simultaneously.*** \033[0m
gmake[1]: *** [/julia/deps/openblas.mk:103: scratch/openblas-8795fc7985635de1ecf674b87e2008a15097ffab/build-compiled] Error 1
gmake: *** [Makefile:86: julia-deps] Error 2
root@:/julia #

```

Then I run `gmake -C deps clean-openblas` then `gmake OPENBLAS_USE_THREAD=0 OPENBLAS_TARGET_ARCH=NEHALEM` but still not resolved.

I would appreciate any suggestion to resolve this.

---

<div class="post-metadata">

**Author:** ![ararslan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ararslan/32/3825_2.png) [@ararslan](https://discourse.julialang.org/u/ararslan)\
**Post date:** [April 8, 2025, 11:04pm UTC](https://discourse.julialang.org/t/julia-on-dragonflybsd/127826/3 "2025-04-08T23:04:29Z")

</div>

There are three main components you’ll need to look at and edit, in this order, as each is a prerequisite of the next:

1. Binary dependencies
2. C/C++ source
3. Julia source

Sounds like you’re currently in step 1 here.

### Binary dependencies

First off, ensure that `USE_BINARYBUILDER=0` is either passed directly to `gmake` or have it defined in the environment. This bypasses the use of compiled dependencies, as we don’t have binaries built for DragonFly. That means that all binary dependencies will be built locally from scratch.

You’ll likely need to go through each of Julia’s binary dependencies (see `deps/`), look them up in DragonFly’s DPorts ([https://gitweb.dragonflybsd.org/dports.git](https://gitweb.dragonflybsd.org/dports.git)), copy any relevant patches into the Julia source tree (`deps/patches/`), and amend the dependencies’ Makefiles in `deps/` to apply the patches. The version of a dependency in DPorts may differ from the version Julia is using, so a given patch may not apply without edits.

Run `gmake -C deps` and hope things work. If they don’t, something will likely need further patching.

### C/C++ source

Julia’s C source (in `src/`) uses C preprocessor macros to condition on the host operating system. You’ll want to edit `src/support/platform.h` to either add an `_OS_DRAGONFLY_` or have `_OS_FREEBSD_` set on DragonFly. The latter could be beneficial if all code paths in the C source that apply to FreeBSD also apply (and will always apply) to DragonFly, but I suspect that’s unlikely to be the case; the former is probably what you want.

You’ll then need to audit the various OS conditionals to see whether DragonFly should be included/excluded from any of them. My guess is that a fair number of the `_OS_FREEBSD_` ones will apply to DragonFly but likely not all of them.

Run `gmake -C src` and hope for the best.

### Julia source

Look for uses of `Sys.is*` and `Sys.KERNEL` to see whether DragonFly also needs to be handled. Luckily, the function `Sys.isdragonfly` already exists, so that can be used appropriately.

Run `gmake`. If you’re lucky, you’ll have a build that mostly works. If you’re extremely lucky, it will even pass most tests.
