Open jakubgs opened 1 month ago
Here is an attempt by Corey to get something working, some parts of the derivation might be useful: codex-flake.nix.txt
This shell script worked, but it didn't include the CMakeLists.txt patch I had to do: shell.nix.txt
Here's how I updated the CMakeLists.txt file (from Claude.ai):
nano /home/petty/codex/repos/nim-codex/vendor/nim-leopard/vendor/leopard/CMakeLists.txt
replace the else
block (just before the add_library
command), add the following:
else()
check_cxx_compiler_flag("-march=native" CXX_FLAG_MARCH_NATIVE)
check_cxx_compiler_flag("-mtune=native" CXX_FLAG_MTUNE_NATIVE)
check_cxx_compiler_flag("-msse" CXX_FLAG_SSE)
check_cxx_compiler_flag("-msse2" CXX_FLAG_SSE2)
check_cxx_compiler_flag("-msse3" CXX_FLAG_SSE3)
check_cxx_compiler_flag("-mssse3" CXX_FLAG_SSSE3)
check_cxx_compiler_flag("-msse4.1" CXX_FLAG_SSE41)
check_cxx_compiler_flag("-msse4.2" CXX_FLAG_SSE42)
check_cxx_compiler_flag("-mavx" CXX_FLAG_AVX)
check_cxx_compiler_flag("-mavx2" CXX_FLAG_AVX2)
if(CXX_FLAG_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
if(CXX_FLAG_MTUNE_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=native")
endif()
if(CXX_FLAG_SSE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse")
endif()
if(CXX_FLAG_SSE2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
endif()
if(CXX_FLAG_SSE3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3")
endif()
if(CXX_FLAG_SSSE3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3")
endif()
if(CXX_FLAG_SSE41)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
endif()
if(CXX_FLAG_SSE42)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
endif()
if(CXX_FLAG_AVX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
endif()
if(CXX_FLAG_AVX2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
endif()
We are shipping two binaries right now codex
and crdl
(Circuit download tool)
@markoburcul, the following lines in Makefile
+ CXXFLAGS ?= -std=c++17 -mssse3
+ export CXXFLAGS
broke the builds on Linux arm64 with the error - c++: error: unrecognized command-line option ‘-mssse3’
mssse3
are x86 specific and we should not use them for arm
‘sse’ Use scalar floating-point instructions present in the SSE instruction set. This instruction set is supported by Pentium III and newer chips, and in the AMD line by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE instruction set supports only single-precision arithmetic, thus the double and extended-precision arithmetic are still done using 387. A later version, present only in Pentium 4 and AMD x86-64 chips, supports double-precision arithmetic too.
It would be helpful to have a Nix flake for this package. The most basic version would just include a build shell, but a a more advanced version would also include a full derivation and also a NixOS service module.
If possible we should also have CI job for our Nix builds.
This was requested by Corey, but Jarrad would also appreciate it.