Skip to content

Instantly share code, notes, and snippets.

@idontgetoutmuch
idontgetoutmuch / gist:77044a7aa030bc8b5c0213daabb4b12f
Created March 4, 2017 14:20
llvm-general test linker errors
Linking dist/build/test/test ...
Undefined symbols for architecture x86_64:
"llvm::TargetRegistry::lookupTarget(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, llvm::Triple&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)", referenced from:
_LLVM_General_LookupTarget in libHSllvm-general-3.9.0.0-CJVSglxrzErATfXQXzEuNH.a(TargetC.o)
"llvm::raw_fd_ostream::raw_fd_ostream(llvm::StringRef, std::error_code&, llvm::sys::fs::OpenFlags)", referenced from:
_LLVM_General_WithFileRawOStream in libHSllvm-general-3.9.0.0-CJVSglxrzErATfXQXzEuNH.a(RawOStreamC.o)
"llvm::createInternalizePass(std::function<bool (llvm::GlobalValue const&)>)", referenced from:
_LLVM_General_AddInternalizePass in libHSllvm-general-3.9.0.0-CJVSglxrzErATfXQXzEuNH.a(PassManagerC.o)
"llvm::sys::getProcessTriple[abi:cxx11]()", referenced from:
_LLVM_General_GetProcessTargetTriple in libHSllvm-general-3.9.0.0-CJVSglxrzErATfXQXzEuNH.a(TargetC.o)
Hogsmill:llvm-general dom$ ./dist/build/test/test
llvm-general:
CallingConvention:
: [OK]
fastcc: [OK]
coldcc: [OK]
ghccc: [OK]
cc11: [OK]
webkit_jscc: [OK]
anyregcc: [OK]
@idontgetoutmuch
idontgetoutmuch / gist:a37e8262406000b5d662594aeb7d60eb
Created March 4, 2017 16:33
accelerate-llvm fails to build
cabal build
Building accelerate-llvm-1.0.0.0...
Preprocessing library accelerate-llvm-1.0.0.0...
[24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, dist/build/Data/Range/Range.o )
ghc:
lookupSymbol failed in relocateSection (relocate external)
/usr/local/Cellar/llvm/3.9.1/lib/libLLVMLTO.a: unknown symbol `__ZN4llvm15PrintStatisticsEv'
ghc: Could not on-demand load symbol '__ZNSt3__16vectorIPN4llvm8ConstantENS_9allocatorIS3_EEE21__push_back_slow_pathIRKS3_EEvOT_'
GHC runtime linker: fatal error: I found a duplicate definition for symbol
@idontgetoutmuch
idontgetoutmuch / CRC32.hs
Created March 6, 2017 14:45
A simple-ish example
module CRC32 (crc32_tab, crc32, crc32String) where
import Data.Bits
import Data.Word
import Data.Char
-- table and sample code derived from
-- http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/libkern/crc32.c
-- * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
-- * code or tables extracted from it, as desired without restriction.
@idontgetoutmuch
idontgetoutmuch / gist:dc882755a64b27fe51239f6db4fa4699
Created April 30, 2017 08:14
meta_add("MetaDiffEq") # Adds all of the packages, even those unregistered
julia> meta_add("MetaDiffEq") # Adds all of the packages, even those unregistered
INFO: Loading MetaSpec from /Users/dom/.julia/v0.5/MetaPkg/src/../requires/MetaDiffEq
INFO: Adding meta package: MetaDiffEq
INFO: Going to run: Pkg.clone("git@github.com:JuliaDiffEq/DiffEqBifurcate.jl")
INFO: Cloning DiffEqBifurcate from git@github.com:JuliaDiffEq/DiffEqBifurcate.jl
Passphrase for /Users/dom/.ssh/id_rsa:
ERROR: GitError(Code:EEOF, Class:SSH, ERROR: Repository not found.
)
in macro expansion at ./libgit2/error.jl:99 [inlined]
in clone(::String, ::SubString{String}, ::Base.LibGit2.CloneOptions) at ./libgit2/repository.jl:191
oneStepH98 :: Double -> (V2 Double, V2 Double) -> (V2 Double, V2 Double)
oneStepH98 h prev = (qNew, pNew)
where
h2 = h / 2
hs = pure h
h2s = pure h2
p2 = psPrev - h2s * nablaQ qsPrev
qNew = qsPrev + hs * nablaP p2
pNew = p2 - h2s * nablaQ qNew
qsPrev = P.fst prev
e = 0.6
q10 = 1 - e
q20 = 0.0
p10 = 0.0
p20 = sqrt((1 + e) / (1 - e))
h = 0.1
dummyStart = ((q10, q20), (p10, p20))
using StaticArrays
e = 0.6
q10 = 1 - e
q20 = 0.0
p10 = 0.0
p20 = sqrt((1 + e) / (1 - e))
h = 0.01
@idontgetoutmuch
idontgetoutmuch / SV.jl
Created May 13, 2017 06:00
A Rookie Error
using StaticArrays
e = 0.6
q10 = 1 - e
q20 = 0.0
p10 = 0.0
p20 = sqrt((1 + e) / (1 - e))
h = 0.01
<pre class="sourceCode haskell"><code class="sourceCode haskell"><span style="">&gt;</span> <span style="color: green;">{-# OPTIONS_GHC -Wall #-}</span>
<span style="">&gt;</span> <span style="color: green;">{-# OPTIONS_GHC -fno-warn-name-shadowing #-}</span>
<span style="">&gt;</span> <span style="color: green;">{-# OPTIONS_GHC -fno-warn-type-defaults #-}</span>
<span style="">&gt;</span> <span style="color: green;">{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}</span>
<span style="">&gt;</span> <span style="color: green;">{-# OPTIONS_GHC -fno-warn-missing-methods #-}</span>
<span style="">&gt;</span> <span style="color: green;">{-# OPTIONS_GHC -fno-warn-orphans #-}</span>
<span style="">&gt;</span>
<span style="">&gt;</span> <span style="color: blue; font-weight: bold;">import</span> <span style="">Symplectic</span>
<span style="">&gt;</span>
<span style="">&gt;</span> <span style="">main</span> <span style="color: red;">::</span> <span style="">IO</span> <span style=""