rlguy / GridFluidSim3D

A PIC/FLIP fluid simulation based on the methods found in Robert Bridson's "Fluid Simulation for Computer Graphics"
zlib License
783 stars 95 forks source link

Compilation error #6

Closed mbah360 closed 8 years ago

mbah360 commented 8 years ago

Hi Can you please give any hints on resolving the issue below while running make. I'm using Fedora 22 64 bit, l have nvidia cuda installed, as well as the intel OpenCLSDK installed. Had this same issue/stuck error on Ubuntu.

Thanks Stephen

g++ -O3 -std=c++11 -Wall -c -o src/fluidsimulationsavestate.o src/fluidsimulationsavestate.cpp g++ -O3 -std=c++11 -Wall -c -o src/fluidsource.o src/fluidsource.cpp g++ -O3 -std=c++11 -Wall -c -o src/gridindexkeymap.o src/gridindexkeymap.cpp g++ -O3 -std=c++11 -Wall -c -o src/gridindexvector.o src/gridindexvector.cpp g++ -O3 -std=c++11 -Wall -c -o src/implicitpointprimitive.o src/implicitpointprimitive.cpp g++ -O3 -std=c++11 -Wall -c -o src/implicitsurfacescalarfield.o src/implicitsurfacescalarfield.cpp g++ -O3 -std=c++11 -Wall -c -o src/interpolation.o src/interpolation.cpp g++ -O3 -std=c++11 -Wall -c -o src/isotropicparticlemesher.o src/isotropicparticlemesher.cpp In file included from src/isotropicparticlemesher.h:28:0, from src/isotropicparticlemesher.cpp:20: src/fragmentedvector.h: In instantiation of ‘bool FragmentedVector::_isLastNode(int) [with T = vmath::vec3]’: src/fragmentedvector.h:104:19: required from ‘void FragmentedVector::push_back(T) [with T = vmath::vec3]’ src/isotropicparticlemesher.cpp:217:56: required from here src/fragmentedvector.h:305:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] return i == _nodes.size() - 1; ^ g++ -O3 -std=c++11 -Wall -c -o src/levelset.o src/levelset.cpp g++ -O3 -std=c++11 -Wall -c -o src/logfile.o src/logfile.cpp g++ -O3 -std=c++11 -Wall -c -o src/macvelocityfield.o src/macvelocityfield.cpp g++ -O3 -std=c++11 -Wall -c -o src/main.o src/main.cpp g++ -O3 -std=c++11 -Wall -c -o src/particleadvector.o src/particleadvector.cpp g++ -O3 -std=c++11 -Wall -c -o src/polygonizer3d.o src/polygonizer3d.cpp g++ -O3 -std=c++11 -Wall -c -o src/pressuresolver.o src/pressuresolver.cpp g++ -O3 -std=c++11 -Wall -c -o src/spatialpointgrid.o src/spatialpointgrid.cpp g++ -O3 -std=c++11 -Wall -c -o src/sphericalfluidsource.o src/sphericalfluidsource.cpp g++ -O3 -std=c++11 -Wall -c -o src/stopwatch.o src/stopwatch.cpp g++ -O3 -std=c++11 -Wall -c -o src/trianglemesh.o src/trianglemesh.cpp g++ -O3 -std=c++11 -Wall -c -o src/turbulencefield.o src/turbulencefield.cpp g++ -O3 -std=c++11 -Wall -c -o src/vmath.o src/vmath.cpp g++ src/aabb.o src/anisotropicparticlemesher.o src/clscalarfield.o src/collision.o src/cuboidfluidsource.o src/diffuseparticlesimulation.o src/fluidbrickgrid.o src/fluidbrickgridsavestate.o src/fluidmaterialgrid.o src/fluidsimulation.o src/fluidsimulationsavestate.o src/fluidsource.o src/gridindexkeymap.o src/gridindexvector.o src/implicitpointprimitive.o src/implicitsurfacescalarfield.o src/interpolation.o src/isotropicparticlemesher.o src/levelset.o src/logfile.o src/macvelocityfield.o src/main.o src/particleadvector.o src/polygonizer3d.o src/pressuresolver.o src/spatialpointgrid.o src/sphericalfluidsource.o src/stopwatch.o src/trianglemesh.o src/turbulencefield.o src/vmath.o -lOpenCL -o fluidsim /usr/bin/ld: cannot find -lOpenCL collect2: error: ld returned 1 exit status Makefile:59: recipe for target 'fluidsim' failed make: *\ [fluidsim] Error 1 [steve@localhost GFSM]$

my path below

[steve@localhost GFSM]$ $PATH bash: /etc/OpenCL:/usr/lib64:/usr/local/cuda-7.5/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/steve/.local/bin:/home/steve/bin: No such file or directory [steve@localhost GFSM]$

rlguy commented 8 years ago

Hello mbah360,

From the output, it looks like the OpenCL headers were found and the program was able to compile, but the OpenCL library was not found and that is why the linker failed with "/usr/bin/ld: cannot find -lOpenCL".

This could be because the OpenCL library is not in your search path. What directory is your OpenCL library in, and what is the filename? I believe the OpenCL library should have a filename like libOpenCL.so or libOpenCL.a.

In the case that the OpenCL library is not on the search path, you may edit the OPENCLLIBPATH variable in the Makefile to point to the directory that contains your OpenCL library file.

#Example:
OPENCLLIBPATH=-L"/path_to_library/"

The -L flag will add the _path_tolibrary directory to the library search path.

I hope this solves the issue for you.

Best Regards, Ryan