cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.13k stars 7.05k forks source link

Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY) #9546

Closed raould closed 9 years ago

raould commented 9 years ago

Ubuntu 14.04 intel 32bit :~/Dev/cocos2d-x/Test/MyTest$ dpkg-query -l|egrep -i "glew|glfw" ii glew-utils 1.10.0-3 i386 OpenGL Extension Wrangler - utilities ii libglew-dbg 1.10.0-3 i386 OpenGL Extension Wrangler (debugging symbols) ii libglew1.10:i386 1.10.0-3 i386 OpenGL Extension Wrangler - runtime environment rc libglew1.8:i386 1.9.0.is.1.8.0-0ubuntu2 i386 OpenGL Extension Wrangler - runtime environment ii libglewmx1.10:i386 1.10.0-3 i386 OpenGL Extension Wrangler (Multiple Rendering Contexts) rc libglewmx1.8:i386 1.9.0.is.1.8.0-0ubuntu2 i386 OpenGL Extension Wrangler (Multiple Rendering Contexts)

ERROR: :~/Dev/cocos2d-x/Test/MyTest$ cocos run -p linux Running command: compile Building mode: debug running: 'cmake ../frameworks'

It appears you are builing natively for Linux with GCC -- OpenGL include dirs: /usr/include CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY) Call Stack (most recent call first): /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-2.8/Modules/FindGLEW.cmake:27 (find_package_handle_standard_args) cocos2d-x/cmake/Modules/CocosBuildHelpers.cmake:44 (find_package) cocos2d-x/CMakeLists.txt:158 (cocos_find_package)

-- Configuring incomplete, errors occurred! See also "/home/x/Dev/cocos2d-x/Test/MyTest/linux-build/CMakeFiles/CMakeOutput.log". Error running command, return code: 1

zilongshanren commented 9 years ago

Have you installed GLEW on your system? If so, please refer to https://github.com/cocos2d/cocos2d-x/pull/9544 And add FindGLEW.cmake to the cmake/Module. thanks.

raould commented 9 years ago

Thanks for your comment. The part in the logs above "dpkg-query -l|egrep -i "glew|glfw"" is showing what I already have installed, so I think I already have lib GLEW installed. Is there anybody else using Ubuntu who has this problem who has fixed it? Obviously #9544 has that problem on Ubuntu 12, I'm on Ubuntu 14. What is the smallest local change to the CMake files to fix it, does anybody know?

vovkasm commented 9 years ago

@raould, can you run this command in you environment, please:

sudo find /usr -iname '*glew*' -print

For ex, on my ArchLinux, results are:

/usr/bin/glewinfo
/usr/lib/libGLEWmx.so.1.11
/usr/lib/libGLEW.so
/usr/lib/libGLEW.so.1.11.0
/usr/lib/libGLEW.so.1.11
/usr/lib/pkgconfig/glewmx.pc
/usr/lib/pkgconfig/glew.pc
/usr/lib/libGLEWmx.so
/usr/lib/libGLEWmx.so.1.11.0
/usr/share/cmake-3.0/Help/module/FindGLEW.rst
/usr/share/cmake-3.0/Modules/FindGLEW.cmake
/usr/share/licenses/lib32-glew
/usr/share/licenses/glew
/usr/lib32/libGLEW.so
/usr/lib32/libGLEW.so.1.11.0
/usr/lib32/libGLEW.so.1.11
/usr/lib32/pkgconfig/glew.pc
/usr/include/GL/glew.h
/usr/include/GL/wglew.h
vovkasm commented 9 years ago

I just install ubuntu/trusty32 (Official Ubuntu Server 14.04 LTS (Trusty Tahr) builds) with vagrant.

Output was:

-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/i386-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/i386-linux-gnu/libGL.so
-- OpenGL include dirs: /usr/include
-- Found GLEW: /usr/include
-- GLEW include dirs: /usr/include
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- PkgConfig found
-- checking for module 'glfw3'
--   found glfw3, version 3.0.4
-- GLFW3 include dirs: /usr/local/include/GLFW
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- FMODEX include dirs: /home/vagrant/cocos2d-x/external/linux-specific/fmod/include/32-bit
-- checking for one of the modules 'fontconfig'
-- Found Fontconfig: TRUE (found version "2.11.0")
-- Fontconfig include dirs: /usr/include/freetype2
-- Freetype include dirs: /home/vagrant/cocos2d-x/external/freetype2/include/linux;/home/vagrant/cocos2d-x/external/freetype2/include/linux
-- WebP include dirs: /home/vagrant/cocos2d-x/external/webp/include/linux
-- Chipmunk include dirs: /home/vagrant/cocos2d-x/external/chipmunk/include/chipmunk
-- TinyXML2 include dirs: /home/vagrant/cocos2d-x/external/tinyxml2
-- JPEG include dirs: /home/vagrant/cocos2d-x/external/jpeg/include/linux
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.8")
-- ZLIB include dirs: /usr/include
-- MINIZIP include dirs: /home/vagrant/cocos2d-x/external/unzip
-- Found PNG: /usr/lib/i386-linux-gnu/libpng.so (found version "1.2.50")
-- PNG include dirs: /usr/include;/usr/include
-- TIFF include dirs: /home/vagrant/cocos2d-x/external/tiff/include/linux
-- WEBSOCKETS include dirs: /home/vagrant/cocos2d-x/external/websockets/include/linux
-- CURL include dirs:
-- Flatbuffers libs: flatbuffers
-- Flatbuffers include dirs: /home/vagrant/cocos2d-x/external
-- OPENGL add to include_dirs: /usr/include
-- OPENGL libs added to 'cocos2d': /usr/lib/i386-linux-gnu/libGLU.so;/usr/lib/i386-linux-gnu/libGL.so;/usr/lib/i386-linux-gnu/libSM.so;/usr/lib/i386-linux-gnu/libICE.so;/usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so
-- GLEW add to include_dirs: /usr/include
-- GLEW libs added to 'cocos2d': /usr/lib/i386-linux-gnu/libGLEW.so
-- GLFW3 add to include_dirs: /usr/local/include/GLFW
-- GLFW3 add to link_dirs: /usr/local/lib
-- GLFW3 libs added to 'cocos2d': glfw
-- GLFW3 add definitions: -DGLFW_DLL
-- FMODEX add to include_dirs: /home/vagrant/cocos2d-x/external/linux-specific/fmod/include/32-bit
-- FMODEX libs added to 'cocos2d': /home/vagrant/cocos2d-x/external/linux-specific/fmod/prebuilt/32-bit/libfmodex.so;/home/vagrant/cocos2d-x/external/linux-specific/fmod/prebuilt/32-bit/libfmodexL.so
-- FONTCONFIG add to include_dirs: /usr/include/freetype2
-- FONTCONFIG libs added to 'cocos2d': fontconfig;freetype
-- THREADS libs added to 'cocos2d': -lpthread
-- ZLIB add to include_dirs: /usr/include
-- ZLIB libs added to 'cocos2d': /usr/lib/i386-linux-gnu/libz.so
-- MINIZIP add to include_dirs: /home/vagrant/cocos2d-x/external/unzip
-- MINIZIP libs added to 'cocos2d': unzip
-- JPEG add to include_dirs: /home/vagrant/cocos2d-x/external/jpeg/include/linux
-- JPEG libs added to 'cocos2d': /home/vagrant/cocos2d-x/external/jpeg/prebuilt/linux/32-bit/libjpeg.a
-- PNG add to include_dirs: /usr/include;/usr/include
-- PNG libs added to 'cocos2d': /usr/lib/i386-linux-gnu/libpng.so;/usr/lib/i386-linux-gnu/libz.so
-- TIFF add to include_dirs: /home/vagrant/cocos2d-x/external/tiff/include/linux
-- TIFF libs added to 'cocos2d': /home/vagrant/cocos2d-x/external/tiff/prebuilt/linux/32-bit/libtiff.a
-- TinyXML2 add to include_dirs: /home/vagrant/cocos2d-x/external/tinyxml2
-- TinyXML2 libs added to 'cocos2d': tinyxml2
-- FREETYPE add to include_dirs: /home/vagrant/cocos2d-x/external/freetype2/include/linux;/home/vagrant/cocos2d-x/external/freetype2/include/linux
-- FREETYPE libs added to 'cocos2d': /home/vagrant/cocos2d-x/external/freetype2/prebuilt/linux/32-bit/libfreetype.a
-- WEBSOCKETS add to include_dirs: /home/vagrant/cocos2d-x/external/websockets/include/linux
-- WEBSOCKETS libs added to 'cocos2d': /home/vagrant/cocos2d-x/external/websockets/prebuilt/linux/32-bit/libwebsockets.a
-- CURL libs added to 'cocos2d': curl
-- FLATBUFFERS add to include_dirs: /home/vagrant/cocos2d-x/external
-- FLATBUFFERS libs added to 'cocos2d': flatbuffers
-- WEBP add to include_dirs: /home/vagrant/cocos2d-x/external/webp/include/linux
-- WEBP libs added to 'cocos2d': /home/vagrant/cocos2d-x/external/webp/prebuilt/linux/32-bit/libwebp.a
-- CHIPMUNK add to include_dirs: /home/vagrant/cocos2d-x/external/chipmunk/include/chipmunk
-- CHIPMUNK libs added to 'cocos2d': /home/vagrant/cocos2d-x/external/chipmunk/prebuilt/linux/32-bit/libchipmunk.a
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vagrant/build

So. Why I don't have any errors?

zilongshanren commented 9 years ago

Hi, @vovkasm When I try to build cocos2d-x v3 on my Ubuntu 12.04 64bit server, it indeed gives me errors, I added another FindGLEW.cmake to resolve this issue. And I have also made a PR: https://github.com/cocos2d/cocos2d-x/pull/9544 But this PR is not perfect, so I closed it.

But I can build it successfully on my Ubuntu 14.04 desktop. I don't know why. It seems the installation of GLEW is failed. And the script build/install-deps-linux.sh is not working for me. I have to manually install all the dependencies. Anything I have missing here?

After running

sudo find /usr -iname '*glew*' -print

It gives me the following output:

/usr/local/lib/pkgconfig/glew.pc
/usr/share/man/man1/glewinfo.1.gz
/usr/share/doc/libglew1.5
/usr/share/doc/libglew1.6-dev/usr/share/doc/glew-utils/usr/share/doc/libglew1.6
/usr/lib/libGLEW.so.1.5.2
/usr/lib/x86_64-linux-gnu/libGLEW.so.1.6
/usr/lib/x86_64-linux-gnu/libGLEW.a
/usr/lib/x86_64-linux-gnu/libGLEW.so.1.6.0
/usr/lib/x86_64-linux-gnu/libGLEW.so/usr/lib/x86_64-linux-gnu/pkgconfig/glew.pc/usr/lib/libGLEW.so.1.5
/usr/lib64/libGLEW.a
/usr/lib64/libGLEW.so
/usr/lib64/libGLEW.so.1.11.0
/usr/lib64/libGLEW.so.1.11
/usr/lib64/pkgconfig/glew.pc
/usr/include/GL/wglew.h
/usr/include/GL/glew.h
/usr/bin/glewinfo
vovkasm commented 9 years ago

@andyque,

When I try to build cocos2d-x v3 on my Ubuntu 12.04 64bit server, it indeed gives me errors, I added another FindGLEW.cmake to resolve this issue. And I have also made a PR: #9544 But this PR is not perfect, so I closed it.

Yes, 12.04 is another story... I'll try to look into it today (also, only configure part)...

And the script build/install-deps-linux.sh is not working for me. I have to manually install all the dependencies.

Yes, me too. But that script contains list of packages, so I can install them manually.

raould commented 9 years ago

Linux x 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:44 UTC 2014 i686 i686 i686 GNU/Linux

/usr/share/cmake-2.8/Modules/FindGLEW.cmake /usr/share/doc/libglew1.10 /usr/share/doc/glew-utils /usr/share/doc/libglew-dbg /usr/share/doc/libglewmx1.10 /usr/lib/i386-linux-gnu/libGLEWmx.so.1.10 /usr/lib/i386-linux-gnu/libGLEW.so.1.10.0 /usr/lib/i386-linux-gnu/libGLEW.so.1.10 /usr/lib/i386-linux-gnu/libGLEWmx.so.1.10.0 /usr/bin/glewinfo

raould commented 9 years ago

Ok, I re-did things like run the install-deps-linux.sh, and apt-get install glew-utils libglew-dev. I noticed e.g. gnutls failed during the sh script, so I did a manual install. Now I am getting further, past the GLEW problem, hooray! (I apparently am missin CURL libs, next :-)

LotfiAghel commented 9 years ago

i'm install glfw3 manuly and fixed that problem in ubuntu 14 64bit please fallow this link http://stackoverflow.com/questions/17768008/how-to-build-install-glfw-3-and-use-it-in-a-linux-project

ghost commented 7 years ago

i was try install manually all dependencies, but some dependencies have an error, my source.list was broken, and my debian version was Sid (unstable version). I fix it doing downgrade to Jessie.

I follow the step-by-step in this link: https://www.vivaolinux.com.br/dica/apt-pinning-Forcando-downgrades-em-Debian-likes

the link is in pt-br, in this link the author do: 1 - prepare the apt-pinning: for this, create a file named preferences in /etc/apt/ , and insert into the file:

Package: *
Pin: release n= version
Pin-priority:1500

where has version, put the version of the debian distro you want to make downgrade (if you want make downgrade to Jessie version, for example, put Jessie).

2 - Modify the sources.list: Change the source.list of your pc to another compative with the distro you want.

3 - Make downgrade with apt-get: use the command in the terminal (with root):

for i in clean autoclean update dist-upgrade update upgrade autoremove ; do apt-get "$i" ; done

the system will clean the cache of the old source.list, read the new source.list and make downgrade

OBS: if you want to confere the version of your debian distro use the command in terminal: lsb_release -a it will result in a return like this:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.6 (wheezy)
Release: 7.6
Codename: wheezy