<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Linked in libraries when cross-compiling]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1850">@WereCatf</a> Hi,</p>
<p dir="auto">I'm trying to cross-compile a source which needs libncurses. I've built the toolchain using the image branch of your repository <a href="http://github.com" rel="nofollow">github.com</a>:werecatf/source.git and I can compile and run simple binaries.</p>
<p dir="auto">But now, I'd like to build larger projects which depend on other software packages. I have the problem that the cross-compiler doesn't seem to respect library paths.</p>
<p dir="auto">For example, I did this:</p>
<p dir="auto">mdj@xxx:/tmp$ mipsel-openwrt-linux-gcc foo.c -L~/src/werecatf/staging_dir/target-mipsel_24kc_musl-1.1.15/usr/lib -lncursesw<br />
/home/mdj/src/werecatf/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.15/lib/gcc/mipsel-openwrt-linux-musl/5.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: cannot find -lncursesw</p>
<p dir="auto">What could be the problem, and what, in general, is the normal way to do this?</p>
<p dir="auto">Best regards,<br />
Mikael</p>
]]></description><link>http://community.onion.io/topic/1312/linked-in-libraries-when-cross-compiling</link><generator>RSS for Node</generator><lastBuildDate>Tue, 19 May 2026 09:58:32 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/1312.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Jan 2017 19:35:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Linked in libraries when cross-compiling on Sun, 15 Jan 2017 19:36:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1850">@WereCatf</a> Hi,</p>
<p dir="auto">I'm trying to cross-compile a source which needs libncurses. I've built the toolchain using the image branch of your repository <a href="http://github.com" rel="nofollow">github.com</a>:werecatf/source.git and I can compile and run simple binaries.</p>
<p dir="auto">But now, I'd like to build larger projects which depend on other software packages. I have the problem that the cross-compiler doesn't seem to respect library paths.</p>
<p dir="auto">For example, I did this:</p>
<p dir="auto">mdj@xxx:/tmp$ mipsel-openwrt-linux-gcc foo.c -L~/src/werecatf/staging_dir/target-mipsel_24kc_musl-1.1.15/usr/lib -lncursesw<br />
/home/mdj/src/werecatf/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.15/lib/gcc/mipsel-openwrt-linux-musl/5.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: cannot find -lncursesw</p>
<p dir="auto">What could be the problem, and what, in general, is the normal way to do this?</p>
<p dir="auto">Best regards,<br />
Mikael</p>
]]></description><link>http://community.onion.io/post/8554</link><guid isPermaLink="true">http://community.onion.io/post/8554</guid><dc:creator><![CDATA[Mikael Djurfeldt]]></dc:creator><pubDate>Sun, 15 Jan 2017 19:36:22 GMT</pubDate></item><item><title><![CDATA[Reply to Linked in libraries when cross-compiling on Sun, 15 Jan 2017 19:36:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/2010">@Mikael-Djurfeldt</a> The library has been renamed to ncurses, not ncursesw, for compatibility-reasons.</p>
]]></description><link>http://community.onion.io/post/8556</link><guid isPermaLink="true">http://community.onion.io/post/8556</guid><dc:creator><![CDATA[WereCatf]]></dc:creator><pubDate>Sun, 15 Jan 2017 19:36:26 GMT</pubDate></item><item><title><![CDATA[Reply to Linked in libraries when cross-compiling on Sun, 15 Jan 2017 19:38:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1850">@WereCatf</a> In the directory that I gave with -L, there actually is a libncursesw.a, but it doesn't find it! Also, I've tried -lncurses...</p>
]]></description><link>http://community.onion.io/post/8557</link><guid isPermaLink="true">http://community.onion.io/post/8557</guid><dc:creator><![CDATA[Mikael Djurfeldt]]></dc:creator><pubDate>Sun, 15 Jan 2017 19:38:08 GMT</pubDate></item><item><title><![CDATA[Reply to Linked in libraries when cross-compiling on Sun, 15 Jan 2017 19:48:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/2010">@Mikael-Djurfeldt</a> I'm not exactly a cross-compiling wizard myself, either, but here are the steps on how I compile a simple ncurses-based app. First, I use a small script called <code>cross.sh</code> at the root of the LEDE-sources to set up a cross-compiling environment for myself:</p>
<pre><code>#!/bin/bash
pushd .
pushd `dirname $0` &gt; /dev/null
export SCRIPTDIR=`pwd`
popd &gt; /dev/null

cd $SCRIPTDIR
cd staging_dir/toolchain*
cd bin
export PATH=$PATH:$(pwd)
cd $SCRIPTDIR
cd staging_dir
export STAGING_DIR=$(pwd)
cd target-*
export TARGET_DIR=$(pwd)
export CC=mips-openwrt-linux-gcc
export LD=mips-openwrt-linux-ld
export CROSS_COMPILE=mipsel-openwrt-linux-
export CFLAGS="-march=24kec -mtune=24kec -mdsp -D_MIPS_ARCH_MIPS32R2"
export CPPFLAGS="-I${TARGET_DIR}/usr/include"
export LDFLAGS="-L${TARGET_DIR}/lib -L${TARGET_DIR}/usr/lib"
popd
bash
</code></pre>
<p dir="auto">I create a file called curseshello.c:</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;ncurses.h&gt;

void main()
{
    WINDOW *vin;
    initscr();
    start_color();
    init_pair(1,COLOR_YELLOW,COLOR_BLUE);
    init_pair(2,COLOR_BLUE,COLOR_YELLOW);
    init_pair(3,COLOR_BLUE,COLOR_WHITE);
    vin=newwin(12,40,13,0);
    wmove(vin,0,5);
    wprintw(vin,"Hello, World.");
    wbkgd(vin,COLOR_PAIR(1));
    wrefresh(vin);
    getch();
    delwin(vin);
    endwin();
}
</code></pre>
<p dir="auto">Then I proceed to call the <a href="http://cross.sh" rel="nofollow">cross.sh</a> and then compile the above code with: <code>mipsel-openwrt-linux-gcc $CFLAGS curseshello.c -o curseshello -lncurses $CPPFLAGS $LDFLAGS</code></p>
<p dir="auto">A proper cross-compiling wizard would most likely be aghast at all the stupidity I commit here, but I only taught myself rudimentary cross-compiling like two-three weeks ago, and this method works for now, so...</p>
]]></description><link>http://community.onion.io/post/8559</link><guid isPermaLink="true">http://community.onion.io/post/8559</guid><dc:creator><![CDATA[WereCatf]]></dc:creator><pubDate>Sun, 15 Jan 2017 19:48:09 GMT</pubDate></item><item><title><![CDATA[Reply to Linked in libraries when cross-compiling on Sun, 15 Jan 2017 20:03:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1850">@WereCatf</a> Many thanks! I found the source of the problem: Tilde expansion doesn't work juxtaposed to -L. <img src="http://community.onion.io/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=ic093v0mjao" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /> I just had to replace it with $HOME.</p>
<p dir="auto">However, it strange that the tools don't respect LIBRARY_PATH---something I've also tested.</p>
]]></description><link>http://community.onion.io/post/8561</link><guid isPermaLink="true">http://community.onion.io/post/8561</guid><dc:creator><![CDATA[Mikael Djurfeldt]]></dc:creator><pubDate>Sun, 15 Jan 2017 20:03:30 GMT</pubDate></item><item><title><![CDATA[Reply to Linked in libraries when cross-compiling on Tue, 17 Jan 2017 20:19:45 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">May I ask you on which Linux Distribution you are cross compiling?</p>
<p dir="auto">I have tried to build the tool chain (including the LEDE Image) on Kubuntu and on Ubuntu<br />
without success by following this tutorial:</p>
<p dir="auto"><a href="https://wiki.onion.io/Tutorials/Cross-Compile" rel="nofollow">https://wiki.onion.io/Tutorials/Cross-Compile</a></p>
<p dir="auto">with the toolchain from the "Onion Omega2" branch from Onion's git hub</p>
<p dir="auto">This is the error I am getting (on latest Ubuntu LTS):</p>
<p dir="auto"><img src="http://fs5.directupload.net/images/170117/uotek55b.png" alt="Bild Text" class="img-responsive img-markdown" /></p>
<p dir="auto">There had also been a couple of errors before this one that I have managed to fix by recrusive chmodding the whole directory with 777.</p>
]]></description><link>http://community.onion.io/post/8687</link><guid isPermaLink="true">http://community.onion.io/post/8687</guid><dc:creator><![CDATA[Adrian Rix]]></dc:creator><pubDate>Tue, 17 Jan 2017 20:19:45 GMT</pubDate></item><item><title><![CDATA[Reply to Linked in libraries when cross-compiling on Tue, 17 Jan 2017 23:14:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/2303">@Adrian-Rix</a> Sure---I built using the "image" branch of <a href="https://github.com/WereCatf/source.git" rel="nofollow">https://github.com/WereCatf/source.git</a> on a Debian stretch system.</p>
<p dir="auto">Basically, once you have checked that out, you can do just</p>
<p dir="auto">make</p>
<p dir="auto">to get the image, however you might want to select things using</p>
<p dir="auto">make menuconfig</p>
<p dir="auto">first.</p>
]]></description><link>http://community.onion.io/post/8708</link><guid isPermaLink="true">http://community.onion.io/post/8708</guid><dc:creator><![CDATA[Mikael Djurfeldt]]></dc:creator><pubDate>Tue, 17 Jan 2017 23:14:37 GMT</pubDate></item></channel></rss>