Skip to content

Build on FreeBSD #56

@abelbabel

Description

@abelbabel

Hi,

I could compile this on FreeBSD 13.1-RELEASE-p2 amd64, having devel/gmake installed (using gmake then instead of make) and using the following modifications:

--- Makefile_ori        2022-10-16 21:19:22.498824000 +0200
+++ Makefile    2022-10-16 22:40:53.787014000 +0200
@@ -22,10 +22,17 @@
        CFLAGS   += -pthread
        CXXFLAGS += -pthread
 endif
+ifeq ($(UNAME_S),FreeBSD)
+       CFLAGS   += -pthread
+       CXXFLAGS += -pthread
+endif
 
 # Architecture specific
 # TODO: probably these flags need to be tweaked on some architectures
 ifeq ($(UNAME_M),x86_64)
+       CFLAGS += -mavx -mavx2 -mfma -mf16c
+endif
+ifeq ($(UNAME_M),amd64)
        CFLAGS += -mavx -mavx2 -mfma -mf16c
 endif
 ifneq ($(filter arm%,$(UNAME_M)),)

(don't know gmake-Makefiles too much, could be prettier with logical or here ...)

--- ggml.c_ori  2022-10-16 21:19:22.502786000 +0200
+++ ggml.c      2022-10-16 21:28:00.140594000 +0200
@@ -2,7 +2,7 @@

 #if defined(_MSC_VER) || defined(__MINGW32__)
 #include <malloc.h> // using malloc.h with MSC/MINGW
-#else
+#elif !defined(__FreeBSD__)
 #include <alloca.h>
 #endif

Seems not so hard to merge changes into upstream ...

For downloading models ftp/wget is needed.

Kind regards,
abelbabel

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildBuild related issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions