Imagination PowerVR SDK Blog

How to build the ReleaseX11 examples from the SDK??


#1

hi

i tried to cross-compile the PowerVR SDK examples using arm-linux-gnueabhi-g++ but i i got the followig error



/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/bin/ld: cannot find -lX11

/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/bin/ld: cannot find -lXau

collect2: ld returned 1 exit status

make: *** […/Linux_armv7hf/ReleaseX11/OGLES2ChameleonMan] Error 1





the command i made

sudo make PLATFORM=Linux_armv7hf X11BUILD=1 X11ROOT=/media/Stockages/rootfs/usr



the ws.mak is



WS_LIBS = -L$(X11ROOT)/lib/arm-linux-gnueabihf -Wl,–rpath-link,$(X11ROOT)/lib/arm-linux-gnueabihf -lX11 -lXau -ldl

WS_INC = $(X11ROOT)/include/X11



where :

/media/Stockages/rootfs/usr/lib/arm-linux-gnueabihf is the directory which contains libX11.so and libXau.so

/media/Stockages/rootfs/usr/include/X11 is a directory which contains a folder called bitmaps





where i am wrng ?



#2

Hi,



For cross-compiling, the make command you’re using and the changes you have made ws.mak seem ok. I’m not sure why it’s failing to find the libraries.



Can you explain the step’s you have followed to install, configure and run your cross-compiler?

Have you checked the permissions of your mounted file system to ensure that the ‘ld’ command can read from those directories?

Have you been able to successfully build on-device by linking against the same X11 libraries?



Regards,

Joe







#3

HI joe,

thank you first for your reply i appreciated.



well the problem why i was not able to find the two library -lX11 -lXau is that the directory /media/Stockages/rootfs/usr/include/X11 was missing the X11 headers files. now i am able to link against X11 libs and headers but its not over yet i got an anther annoying problem that bother me:





arm-linux-gnueabihf-g++ -o …/Linux_armv7hf/ReleaseX11/OGLES2ChameleonMan …/Linux_armv7hf/ReleaseX11/OGLES2ChameleonMan.o …/Linux_armv7hf/ReleaseX11/skyline.o …/Linux_armv7hf/ReleaseX11/Wall_diffuse_baked.o …/Linux_armv7hf/ReleaseX11/Tang_space_BodyMap.o …/Linux_armv7hf/ReleaseX11/Tang_space_LegsMap.o …/Linux_armv7hf/ReleaseX11/Tang_space_BeltMap.o …/Linux_armv7hf/ReleaseX11/FinalChameleonManLegs.o …/Linux_armv7hf/ReleaseX11/FinalChameleonManHeadBody.o …/Linux_armv7hf/ReleaseX11/lamp.o …/Linux_armv7hf/ReleaseX11/ChameleonBelt.o …/Linux_armv7hf/ReleaseX11/SkinnedVertShader.o …/Linux_armv7hf/ReleaseX11/SkinnedFragShader.o …/Linux_armv7hf/ReleaseX11/DefaultVertShader.o …/Linux_armv7hf/ReleaseX11/DefaultFragShader.o …/Linux_armv7hf/ReleaseX11/ChameleonScene.o …/Linux_armv7hf/ReleaseX11/PVRShell.o …/Linux_armv7hf/ReleaseX11/PVRShellAPI.o …/Linux_armv7hf/ReleaseX11/PVRShellOS.o -march=armv7-a -mfloat-abi=hard -L/media/be90ae91-163e-4bd9-bc00-86e1f7afd8ce/usr/lib/arm-linux-gnueabihf -Wl,–rpath-link,/media/be90ae91-163e-4bd9-bc00-86e1f7afd8ce/usr/lib/arm-linux-gnueabihf -lX11 -lXau -ldl -lrt -lGLESv2 -lEGL -L/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.3_R2/Tools/OGLES2/Build/LinuxGeneric/…/Linux_armv7hf/ReleaseX11 -logles2tools -L"/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.3_R2/Builds/Linux/armv7hf/Lib" -Wl,–rpath-link,"/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.3_R2/Builds/Linux/armv7hf/Lib"



/media/Stockages/usr/lib/arm-linux-gnueabihf/libm.a(fraiseexcpt.o): In function feraiseexcept':<br /> (.text+0xbc): undefined reference to_dl_hwcap’

collect2: ld returned 1 exit status

make: *** […/Linux_armv7hf/ReleaseX11/OGLES2ChameleonMan] Error 1







why the reference to `_dl_hwcap’ is not defined??? what type of error is this and how to solve it ?

again the command i used:

sudo make PLATFORM=Linux_armv7hf X11BUILD=1 X11ROOT=/media/Stockages/rootfs/usr







joe said

Have you been able to successfully build on-device by linking against the same X11 libraries?



i did not try to build on-device because the SDK is installed on the linux host machine



Note: the LInuxRaw build was successful using only the commande sudo make PLATFORM=Linux_armv7hf and i got the executable on

/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.3_R2/Examples/Advanced/ChameleonMan/OGLES2/Build/Linux_armv7hf/ReleaseNullWS



#4

Hello,



The error message you posted I believe is an issue with linking to libc for your device. I believe there is a mismatch occurring.



Could you please confirm what directory the following refers to:



-L/media/be90ae91-163e-4bd9-bc00-86e1f7afd8ce/usr/lib/arm-linux-gnueabihf -Wl,–rpath-link,/media/be90ae91-163e-4bd9-bc00-86e1f7afd8ce/usr/lib/arm-linux-gnueabihf



Is this the same rootfs as /media/Stockages/rootfs?



Could you also please try the following commands.



On the host the following will show the default library search paths:

arm-linux-gnueabihf-g++ -print-search-dirs



And on the device itself could you run:

uname -a



This will confirm the arm variant on the platform.



Thanks,

Paul


#5

Hi paul thank you for reply:



-L/media/be90ae91-163e-4bd9-bc00-86e1f7afd8ce/usr/lib/arm-linux-gnueabihf -Wl,–rpath-link,/media/be90ae91-163e-4bd9-bc00-86e1f7afd8ce/usr/lib/arm-linux-gnueabihf



Is this the same rootfs as /media/Stockages/rootfs?



Could you also please try the following commands.



yes its the same rootfs. here is another reproduction of the error i get:



/*************************************************** Error /

arm-linux-gnueabihf-g++ -o …/Linux_armv7hf/ReleaseX11/OGLES2ChameleonMan …/Linux_armv7hf/ReleaseX11/OGLES2ChameleonMan.o …/Linux_armv7hf/ReleaseX11/skyline.o …/Linux_armv7hf/ReleaseX11/Wall_diffuse_baked.o …/Linux_armv7hf/ReleaseX11/Tang_space_BodyMap.o …/Linux_armv7hf/ReleaseX11/Tang_space_LegsMap.o …/Linux_armv7hf/ReleaseX11/Tang_space_BeltMap.o …/Linux_armv7hf/ReleaseX11/FinalChameleonManLegs.o …/Linux_armv7hf/ReleaseX11/FinalChameleonManHeadBody.o …/Linux_armv7hf/ReleaseX11/lamp.o …/Linux_armv7hf/ReleaseX11/ChameleonBelt.o …/Linux_armv7hf/ReleaseX11/SkinnedVertShader.o …/Linux_armv7hf/ReleaseX11/SkinnedFragShader.o …/Linux_armv7hf/ReleaseX11/DefaultVertShader.o …/Linux_armv7hf/ReleaseX11/DefaultFragShader.o …/Linux_armv7hf/ReleaseX11/ChameleonScene.o …/Linux_armv7hf/ReleaseX11/PVRShell.o …/Linux_armv7hf/ReleaseX11/PVRShellAPI.o …/Linux_armv7hf/ReleaseX11/PVRShellOS.o -march=armv7-a -mfloat-abi=hard -L/media/Stockages/rootfs/usr/lib/arm-linux-gnueabihf -Wl,–rpath-link,/media/Stockages/rootfs/usr/lib/arm-linux-gnueabihf -lX11 -lXau -ldl -lrt -lGLESv2 -lEGL -L/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.3_R2/Tools/OGLES2/Build/LinuxGeneric/…/Linux_armv7hf/ReleaseX11 -logles2tools -L"/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.3_R2/Builds/Linux/armv7hf/Lib" -Wl,–rpath-link,"/opt/Imagination/PowerVR/GraphicsSDK/SDK_3.3_R2/Builds/Linux/armv7hf/Lib"

/media/Stockages/rootfs/usr/lib/arm-linux-gnueabihf/libm.a(fraiseexcpt.o): In function feraiseexcept':<br /> (.text+0xbc): undefined reference to_dl_hwcap’

collect2: ld returned 1 exit status

make: *** […/Linux_armv7hf/ReleaseX11/OGLES2ChameleonMan] Error 1

/
/



/
ws.mak
***************************************************/

ifeq “$(X11BUILD)” "1"

WS_LIBS = -L$(X11ROOT)/lib/arm-linux-gnueabihf -Wl,–rpath-link,$(X11ROOT)/lib/arm-linux-gnueabihf -lX11 -lXau -ldl -lrt

WS_INC = $(X11ROOT)/include/X11

/**/



the outputs of the command arm-linux-gnueabihf-g++ -print-search-dirs on host is

/
/

install: /usr/lib/gcc/arm-linux-gnueabihf/4.6/

programs: =/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/bin/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/bin/arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/bin/

libraries: =/usr/lib/gcc/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/lib/arm-linux-gnueabihf/4.6/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/lib/arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/lib/…/lib/:/usr/lib/gcc/arm-linux-gnueabihf/4.6/…/…/…/…/arm-linux-gnueabihf/lib/

/***************************************************************************************************************************/



the outputs of uname -a on the device:



Linux mohamed-desktop 3.2.0-1452-omap4 #72-Ubuntu SMP PREEMPT Tue Aug 19 20:46:59 UTC 2014 armv7l armv7l armv7l GNU/Linux





and thank u in advance



#6

Hello,



Could you please try the following.



Firstly on the device:

sudo apt-get install libX11-dev



Then re-mount the file system of the device and make the following changes to the Makefile before building the example:



Add to the variable PLAT_CFLAGS the following:



PLAT_CFLAGS += --sysroot=/media/Stockages/rootfs



And to



PLAT_LINK += --sysroot=/media/Stockages/rootfs



My final PLAT_CFLAGS and PLAT_LINK variables look as follows:



PLAT_LINK = $(LIBDIR_FLAGS) --sysroot=/home/main/rootfs -lEGL -lGLESv2 $(WS_LIBS) -L$(TOOLCHAIN)/lib -march=armv7 -mfloat-abi=hard



PLAT_CFLAGS += -O2 --sysroot=/home/main/rootfs



This will ensure that you only use the on-device version of the libraries.



Thanks,

Paul


#7

WOW that helped tooooo much and the error was solved

thank youu very much Paul

the examples was successfully cross-compiled