# \[SOLVED\] Running ReleaseRaw and cross-compiling for X11

**URL:** <https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847>\
**Category:** PowerVR Insider\
**Created:** [July 9, 2013, 5:25am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847 "2013-07-09T05:25:35Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 9, 2013, 5:25am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/1 "2013-07-09T05:25:35Z")

</div>

Hi,  
  
I have difficulties cross-compiling SDK examples for TI OMAP5 running Ubuntu Precise (12.04LTS). Toolchain and SDK are set up and work just fine.  
  
  
  
I can generate raw executable examples but don’t know how to run them. Can you provide some information on that. (In this case I am running program from console without X11.)  
  
When I try to cross-compile for X11 environment, linker fails because of missing X11 libs while native compile for x86\_64 and X11 works fine and program runs.

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [July 9, 2013, 6:56am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/2 "2013-07-09T06:56:01Z")

</div>

Hi,  
  
  
  
Before running null window system (raw) application, you need to ensure X11 has been stopped (if it was running). Once X11 has been killed, you should be able to launch the application from the console.  
  
  
  
If you want to instead build an X11 version of our Examples, you need to set an _X11ROOT_ environment variable that points to your target’s X11 libraries & add _X11BUILD=1_ to your command-line arguments for _make_. Our SDK User Guide also details these steps.  
  
  
  
Let us know if you hit any other issues.  
  
  
  
Thanks,  
  
Joe

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 9, 2013, 9:38am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/3 "2013-07-09T09:38:43Z")

</div>

When building X11, I provide both X11BUILD and X11ROOT so everything is supposed to run.  
  
Compiler passes but I cannot link with X11 libs. This is what I get.

```auto
/home/doking-dev/gcc-linaro-arm-linux-gnueabihf-4.8-2013.06_linux/bin/arm-linux-gnueabihf-g++ -o ../Linux_armv7/ReleaseX11/OGLES2Water ../Linux_armv7/ReleaseX11/OGLES2Water.o ../Linux_armv7/ReleaseX11/NewNormalMap.o ../Linux_armv7/ReleaseX11/Mountain.o ../Linux_armv7/ReleaseX11/wood.o ../Linux_armv7/ReleaseX11/sail.o ../Linux_armv7/ReleaseX11/MountainFloor.o ../Linux_armv7/ReleaseX11/FragShader.o ../Linux_armv7/ReleaseX11/VertShader.o ../Linux_armv7/ReleaseX11/SkyboxFShader.o ../Linux_armv7/ReleaseX11/SkyboxVShader.o ../Linux_armv7/ReleaseX11/ModelFShader.o ../Linux_armv7/ReleaseX11/ModelVShader.o ../Linux_armv7/ReleaseX11/Tex2DFShader.o ../Linux_armv7/ReleaseX11/Tex2DVShader.o ../Linux_armv7/ReleaseX11/PlaneTexFShader.o ../Linux_armv7/ReleaseX11/PlaneTexVShader.o ../Linux_armv7/ReleaseX11/Scene.o ../Linux_armv7/ReleaseX11/PVRShell.o ../Linux_armv7/ReleaseX11/PVRShellAPI.o ../Linux_armv7/ReleaseX11/PVRShellOS.o -L/usr/include/X11//lib -Wl,--rpath-link,/usr/include/X11//lib -lX11 -lXau -lGLESv2 -lEGL -L/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Tools/OGLES2/Build/LinuxGeneric/../Linux_armv7/ReleaseX11 -logles2tools -L"/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Builds/Linux/armv7/Lib" -Wl,--rpath-link,"/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Builds/Linux/armv7/Lib"<br />
/home/doking-dev/gcc-linaro-arm-linux-gnueabihf-4.8-2013.06_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lX11<br />
/home/doking-dev/gcc-linaro-arm-linux-gnueabihf-4.8-2013.06_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lXau<br />
collect2: error: ld returned 1 exit status<br />
make: *** [../Linux_armv7/ReleaseX11/OGLES2Water] Error 1

```

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [July 9, 2013, 9:59am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/4 "2013-07-09T09:59:27Z")

</div>

You should be linking to your target’s X11 libs. Have you accidentally linked to your host machine’s libs while cross-compiling?  
  
  
  
Thanks,  
  
Joe

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 9, 2013, 10:03am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/5 "2013-07-09T10:03:49Z")

</div>

Yes, I have.  
  
So I have to copy libs from my host system and use their path as argument of X11ROOT? Cross-compiling X11 doesn’t look appealing to me.

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [July 9, 2013, 11:04am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/6 "2013-07-09T11:04:12Z")

</div>

If you want to cross-compile for X11, you either have to either copy the libraries from your target to a directory on your host, or mount the target’s X11 directory so you can link against it remotely.  
  
  
  
Thanks,  
  
Joe

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 9, 2013, 11:29am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/7 "2013-07-09T11:29:51Z")

</div>

I have tried both options and both have failed with the same result as before -lX11 and -lXau not found.  
  
I am calling make like this `make PLATFORM=Linux_armv7 X11BUILD=1 X11ROOT=/media/rootfs/usr/include/X11`  
  
Error message is same as few posts before.

---

<div class="post-metadata">

**Author:** ![Scott](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/scott/32/256_2.png) [@Scott](https://forums.imgtec.com/u/Scott)\
**Post date:** [July 9, 2013, 11:52am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/8 "2013-07-09T11:52:07Z")

</div>

Hi,  
  
  
  
The X11ROOT variable is designed to point at the location that has the include and lib folders that contain your X11 libs and headers. Based on what you’ve set your X11ROOT to, could you try  
  
`X11ROOT=/media/rootfs/usr`  
  
  
  
If that doesn’t work, could you let us know where your libX11.so is located on your system.  
  
  
  
Cheers,  
  
  
  
Scott

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 9, 2013, 12:40pm UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/9 "2013-07-09T12:40:45Z")

</div>

libX11.so is in `/media/rootfs/usr/lib/arm-linux-gnueabihf/` libXau is in same directory as well.  
  
I have tried make with /media/rootfs/usr. Again with the same error.

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 9, 2013, 12:47pm UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/10 "2013-07-09T12:47:59Z")

</div>

Just to avoid problems, after each unsuccessful make I do make clean for that build.  
  
Also, what might interest you is contains of .bashrc which is  
  
`export PATH="/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1:$PATH"
export TOOLCHAIN="/home/doking-dev/gcc-linaro-arm-linux-gnueabihf-4.8-2013.06_linux"
`  
  
  
  
$CROSS\_COMPILE is not set and I am using latest Linaro toolchain for armhf

---

<div class="post-metadata">

**Author:** ![Scott](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/scott/32/256_2.png) [@Scott](https://forums.imgtec.com/u/Scott)\
**Post date:** [July 9, 2013, 12:48pm UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/11 "2013-07-09T12:48:26Z")

</div>

> libX11.so is in  
> /media/rootfs/usr/lib/arm-linux-gnueabihf/  
> libXau is in same directory as well.  
> I have tried make with /media/rootfs/usr. Again with the same error.

  
Ok, looks like you'll need to modify the ws.mak in /Builds/Linux/armv7 so all the references to  
`$(X11ROOT)/lib`  
are changed to  
`$(X11ROOT)/lib/arm-linux-gnueabihf`  
Hopefully that'll get things linking.

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 9, 2013, 12:57pm UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/12 "2013-07-09T12:57:26Z")

</div>

OK. We have that working. BUT agony is not over yet 🙂  
  
Linking now stops with this error:  
  
  
  
`/home/doking-dev/gcc-linaro-arm-linux-gnueabihf-4.8-2013.06_linux/bin/…/lib/gcc/arm-linux-gnueabihf/4.8.2/…/…/…/…/arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/libc.so.6
/home/doking-dev/gcc-linaro-arm-linux-gnueabihf-4.8-2013.06_linux/bin/…/lib/gcc/arm-linux-gnueabihf/4.8.2/…/…/…/…/arm-linux-gnueabihf/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libc_nonshared.a
/home/doking-dev/gcc-linaro-arm-linux-gnueabihf-4.8-2013.06_linux/bin/…/lib/gcc/arm-linux-gnueabihf/4.8.2/…/…/…/…/arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
collect2: error: ld returned 1 exit status
make: *** […/Linux_armv7/ReleaseX11/OGLES2Water] Error 1
`

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 10, 2013, 5:54am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/13 "2013-07-10T05:54:08Z")

</div>

My idea why make fails is because cross-compiler supports multiarch. libc.so.6 and other files might have been moved to different location and therefore make fails to locate and use them.  
  
Any solution for that?

---

<div class="post-metadata">

**Author:** ![xenosb-2](https://avatars.discourse-cdn.com/v4/letter/x/d78d45/32.png) [@xenosb-2](https://forums.imgtec.com/u/xenosb-2)\
**Post date:** [July 10, 2013, 7:06am UTC](https://forums.imgtec.com/t/solved-running-releaseraw-and-cross-compiling-for-x11/1847/14 "2013-07-10T07:06:36Z")

</div>

**SOLVED**  
  
  
  
Had to copy contents from /libc/lib to system /lib and /libc/usr/lib to system /usr/lib. Make searches for those files inside of the system libraries instead of the toolchain libs. Maybe this can be fixed more easily by using LD\_LIBRARY\_PATH?  
  
  
  
Thank you guys, helped me a lot.
