1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
html{overflow-y:scroll;background-color:#10400a}
body{font-family:"Noto Sans","Droid Sans","DejaVu Sans","Arial",sans-serif;line-height:1.5}
tt,code{background-color:#f0f0f0;font-family:"Noto Sans Mono","Droid Sans Mono","DejaVu Sans Mono","Courier New",monospace,sans-serif;font-size:1em;}
pre{margin-left:3em}
p,ul,ol,blockquote,pre{font-size:1.0em;line-height:1.6}
li p{font-size:1.0em}
blockquote p{font-size:1.0em}
h1{font-size:1.5em}
h2{font-size:1.3em}
h3{font-size:1.0em}
h1 a{text-decoration:none}
table{border-collapse:collapse}
th,td{border:1px solid black}
table a{text-decoration:none}
table tr{font-size:1.0em;line-height:1.6em}
table tr{font-size:1.0em;line-height:1.5}
tbody tr:nth-child(12n+1){background-color:#f0ffff}
tbody tr:nth-child(12n+2){background-color:#f0ffff}
tbody tr:nth-child(12n+3){background-color:#f0ffff}
tbody tr:nth-child(12n+4){background-color:#f0ffff}
tbody tr:nth-child(12n+5){background-color:#f0ffff}
tbody tr:nth-child(12n+6){background-color:#f0ffff}
tbody tr:nth-child(12n+7){background-color:#fffff0}
tbody tr:nth-child(12n+8){background-color:#fffff0}
tbody tr:nth-child(12n+9){background-color:#fffff0}
tbody tr:nth-child(12n+10){background-color:#fffff0}
tbody tr:nth-child(12n+11){background-color:#fffff0}
tbody tr:nth-child(12n+12){background-color:#fffff0}
#headline{display:block;margin:0;padding:0;color:#ffffff;background-color:#10400a}
#headline .text{font-weight:bold;font-size:1.0em}
#headline input{display:none}
#nav ul{margin:0;padding:0}
#nav li{list-style-type:none;margin:0;padding:0}
.navtop{padding-bottom:0.5em;font-weight:bold;font-size:1.0em}
.navtop{background-color:#10400a;color:#ffffff}
#nav .here{background-color:#10400a;color:#ffffff}
#nav .away{background-color:#10400a;color:#ffffff}
#nav .away a{text-decoration:none;display:block;color:#ffffff}
#nav .away a:hover,.away a:active{text-decoration:underline}
#hidemenu{visibility:hidden;display:none;overflow:hidden;position:fixed;top:0;left:0;height:100%;width:100%}
.main{padding:5px}
.main{background-color:#ffffff}
.pagetitle{font-size:1.4em;font-weight:bold}
@media only screen and (min-width:512px) {
.navtop{padding-top:5px}
#headline{top:0;margin:0;width:160px;height:100%;position:fixed;overflow:auto}
#headline .noselect{display:none}
#headline #nav{visibility:visible;display:block;width:auto;height:auto}
.main{margin-left:170px}
#headline #hidemenu{visibility:hidden}
}
@media not screen and (min-width:512px) {
#headline .noselect{-webkit-user-select:none;-ms-user-select:none;user-select:none;}
#headline #nav #navbot{visibility:hidden;position:fixed;top:0;left:-70%;z-index:2;transition:0.2s;margin:0;padding:0}
#headline input:checked ~ #nav #navbot{height:100%;position:fixed;top:0;left:0;visibility:visible;display:block;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;vertical-align:center;font-size:1.0em;width:70%;overflow:auto}
#headline input:checked ~ #hidemenu{visibility:visible;display:block;background:black;opacity:0.3;z-index:1}
}
</style>
<title>
libcpucycles: Install</title>
</head>
<body>
<label id=headline>
<input type=checkbox />
<nav id=nav>
<div class=navtop>
<span class=noselect>≡</span>
libcpucycles</div>
<ul id=navbot>
<li class=away><a href=index.html>Intro</a>
</li><li class=away><a href=download.html>Download</a>
</li><li class=here>Install
</li><li class=away><a href=api.html>API</a>
</li><li class=away><a href=counters.html>Counters</a>
</li><li class=away><a href=selection.html>Selection</a>
</li><li class=away><a href=security.html>Security</a>
</li><li class=away><a href=license.html>License</a>
</li></ul></nav>
<div id=hidemenu></div>
</label>
<div class=main>
<div class=pagetitle>libcpucycles: Install</div>
<p>Prerequisites:</p>
<ul>
<li><code>python3</code> (for: build)</li>
<li><code>gcc</code> and/or <code>clang</code> (for: build)</li>
</ul>
<p>Currently tested only under Linux,
but porting to other systems shouldn't be difficult.</p>
<h3>For sysadmins</h3>
<p>To install in <code>/usr/local/{include,lib,bin,man}</code>:</p>
<pre><code>./configure && make -j8 install
</code></pre>
<h3>For developers with an unprivileged account</h3>
<p>Typically you'll already have</p>
<pre><code>export LD_LIBRARY_PATH="$HOME/lib"
export LIBRARY_PATH="$HOME/lib"
export CPATH="$HOME/include"
export PATH="$HOME/bin:$PATH"
</code></pre>
<p>in <code>$HOME/.profile</code>. To install in <code>$HOME/{include,lib,bin,man}</code>:</p>
<pre><code>./configure --prefix=$HOME && make -j8 install
</code></pre>
<h3>For distributors creating a package</h3>
<p>Run</p>
<pre><code>./configure --prefix=/usr && make -j8
</code></pre>
<p>and then follow your usual packaging procedures for the
<code>build/0/package</code> files:</p>
<pre><code>build/0/package/man/man3/cpucycles.3
build/0/package/include/cpucycles.h
build/0/package/lib/libcpucycles*
build/0/package/bin/cpucycles-info
build/0/package/bin/cpucycles-open
</code></pre>
<p>There are some old systems where libcpucycles requires <code>-lrt</code> for
<code>clock_gettime</code>; currently <code>libcpucycles.so</code> doesn't link to <code>-lrt</code>,
so it's up to the caller to link to <code>-lrt</code>.</p>
<p>You may wish to provide a package that runs <code>cpucycles-open</code> on each boot,
but this should be separate from the main <code>cpucycles</code> package:
<code>cpucycles</code> is functional without <code>cpucycles-open</code>,
and some security policies are contrary to <code>cpucycles-open</code>.</p>
<h3>More options</h3>
<p>You can run</p>
<pre><code>./configure --host=amd64
</code></pre>
<p>to override <code>./configure</code>'s guess of the architecture that it should
compile for. The architecture controls which cycle counters to try
compiling: e.g., <code>amd64</code> tries compiling <code>cpucycles/amd64*</code> and
<code>cpucycles/default*</code>.</p>
<p>Inside the <code>build</code> directory, <code>0</code> is symlinked to <code>amd64</code> for
<code>--host=amd64</code>. Running <code>make clean</code> removes <code>build/amd64</code>. Re-running
<code>./configure</code> automatically starts with <code>make clean</code>.</p>
<p>A subsequent <code>./configure --host=arm64</code> will create <code>build/arm64</code> and
symlink <code>0 -> arm64</code>, without touching an existing <code>build/amd64</code>.
However, cross-compilers aren't yet selected automatically.</p>
<p>Compilers tried are listed in <code>compilers/default</code>. Each compiler
includes <code>-fPIC</code> to create a shared library, <code>-fvisibility=hidden</code> to
hide non-public symbols in the library, and <code>-fwrapv</code> to switch to a
slightly less dangerous version of C. The first compiler that seems to
work is used to compile everything.</p><hr><font size=1><b>Version:</b>
This is version 2025.12.26 of the "Install" web page.
</font>
</div>
</body>
</html>
|