Cocos2dx linux cannot find libglew

Cocos2dx linux cannot find libglew
0

Hello,
I am using cocos2dx on linux
When I run command
cocos run -p linux
I get

/home/gust/Desktop/myproject/bin/debug/linux/myproject: error while loading shared libraries: libGLEW.so.2.1: cannot open shared object file: No such file or directory
Error running command, return code: 127.

i tried installing libglew with sudo apt
and putting libglew2.so path with set in cmakelists and the beginning for include and lib and tried putting the path in my .profile also and tried copying a downloaded glew folder into the executable folder but it gets overwritten when i run the cocos run -p linux command anyway i dont know how to fix this anymore

What distro?

Did you see our Linux install doc?

ubuntu 18.2

Great, did you follow our doc?

https://docs.cocos2d-x.org/cocos2d-x/v3/en/installation/Linux.html

well i went off what ik when i installed it on windows but now i did follow it and got a project and running cocos run -p linux and it compiles to 99% and then i get this error

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftbase.linux64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftinit.linux64.o): relocation R_X86_64_32 against symbol `tt_driver_class' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftsystem.linux64.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(sfnt.linux64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(psaux.linux64.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(psnames.linux64.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(pfr.linux64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(truetype.linux64.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(winfnt.linux64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(type1.linux64.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(type42.linux64.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(cff.linux64.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(type1cid.linux64.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(bdf.linux64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(pcf.linux64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftf.linux64.o): relocation R_X86_64_32S against `.text' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(smooth.linux64.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(raster.linux64.o): relocation R_X86_64_32S against symbol `ft_raster1_renderer_class' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(autofit.linux64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(pshinter.linux64.o): relocation R_X86_64_32S against `.text' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftglyph.linux64.o): relocation R_X86_64_32S against symbol `ft_bitmap_glyph_class' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftstroke.linux64.o): relocation R_X86_64_32S against symbol `ft_outline_glyph_class' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftgzip.linux64.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftlzw.linux64.o): relocation R_X86_64_32S against `.text' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: ../cocos2d/external/freetype2/prebuilt/linux/64-bit/libfreetype.a(ftbitmap.linux64.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output

collect2: error: ld returned 1 exit status

CMakeFiles/testcocos2.dir/build.make:185: recipe for target 'bin/testcocos2/testcocos2' failed

make[2]: *** [bin/testcocos2/testcocos2] Error 1

CMakeFiles/Makefile2:78: recipe for target 'CMakeFiles/testcocos2.dir/all' failed

make[1]: *** [CMakeFiles/testcocos2.dir/all] Error 2

Makefile:83: recipe for target 'all' failed

make: *** [all] Error 2

hmm, I think a PR was supposed to take care of this.

But, please see this: Can't make Cocos2d-x compile on Ubuntu 18.04