Coder Social home page Coder Social logo

Building on OSX about gridfluidsim3d HOT 28 CLOSED

rlguy avatar rlguy commented on August 20, 2024
Building on OSX

from gridfluidsim3d.

Comments (28)

rtolps avatar rtolps commented on August 20, 2024 1

I installed TeamViewer, I'm desperate. Before I go ahead and let a helpful, trustworthy-looking random stranger into my computer, can you like make a .dmg file and put it on dropbox or something?

from gridfluidsim3d.

melMass avatar melMass commented on August 20, 2024 1

Got it:

cmake ../ -DOpenCL_INCLUDE_DIR:PATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenCL.framework"
make -j12

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

Hey, I'm glad you're interested in the program. I do not have an OS X machine to build and test on so I'm not sure if the program will compile and run without errors. Let me know if you run into any errors and I will try my best to fix them.

To compile program you will need to install the GCC compiler and install GNU Make. This link gives instructions for how to install GCC and GNU Make on OS X.

The program uses the OpenCL library, so you will need make sure you have the library and header files on your machine. OS X may already have the files that you need, but I am not entirely sure.

You will also need to edit the Makefile and change the OPENCLINCLUDE and OPENCLLIB variables to point to where your OpenCL include directory is, and where your OpenCL library file is.

Let me know if you run into any problems, and I will try to help!

The program does not use OpenVDB. The particle meshing methods are all contained within the program.

from gridfluidsim3d.

magnusviri avatar magnusviri commented on August 20, 2024

I would gladly fire up a VM you can ssh or vnc into if you wanted to tweak it for OS X.

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

You people are amazing. You should try developing for blender.

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

Can't find OpenCL.framework in /libraries/frameworks any mac developers here to help?

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

Thank you very much for the offer, magnusviri. I may take you up on it if I need to.

I have acquired access to a Mac computer to test on over this coming weekend, so I'll try to work out how to get this program running on OS X as soon as I can.

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

How did it go? Any luck building it.

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

Hello rtolps,

I was able to build the program on OS X, but I am encountering an error ( _Assertion failed: (particleAdvector.initialize()) ) when trying to run the program, and I am currently working on resolving that error. Updates for the program to build on OS X are currently located in the osx_build branch.

Here is what I have done to get the program to build on OS X (El Capitan Version 10.11.4):

Install Xcode from the Apple App Store. Installing Xcode gave me access to GNU Make, the clang c++ compiler, and the OpenCL headers and libraries.

I found that my machine was missing the cl.hpp header, so you might need to download cl.hpp from khronos.org and place it in:

For Xcode < 4.3

/Developer/SDKs/MacOSX <Version>.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers

For Xcode >=4.3

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX <Version>.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers

You will probably need the cl.hpp file version that matches the version of OpenCL on your machine. I needed version 1.1.

Once I had done that, I was able to build the program using the command

make -f Makefile-OSX

And run with the command

./fluidsim

I'll keep you updated on my progress with getting this program to run on OS X.

Best Regards,
Ryan

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

Update: The program now builds and runs on the OS X machine that I am testing on. The updates to the program are now merged into the master branch.

Let me know if you run into any problems building/running the program.

Best Regards,
Ryan

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

What program/library or terminal extension do I need to run the makefile? Terminal doesn't recognise any of the commands.

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

The GNU Make program is used to run the makefile. The program was installed automatically when I installed Xcode. It looks like some users may have to enable the download within Xcode.

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

when you say run with the command do you mean in the same line? (make command should work, I realized what I did wrong. I was lazy and double clicked, maybe you should make a "build/run this program" batch file for noobs who want to build it without opening terminal?).

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

I'm afraid if I type it in wrong I'll screw up.

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

Hello rtolps,

When I said run with ./fluidsim, I meant to execute that command after the make -f Makefile-OSX command finishes running. The make command invokes the GNU Make program and tells it to run the script located in the the Makefile-OSX file. Once the make command finished running, it will create the executable simulation file fluidsim. The command ./fluidsim simply just executes that file.

If you want, you can create a shell script named something like "runandbuild.sh", place it in the fluid simulation directory, and copy these lines into the file:

#!/bin/bash
make -f Makefile-OSX
./fluidsim

The first line tells your system to use the bash program, which is what your terminal runs, to execute the commands in the script. Make sure that the file has permission to execute and it should run when you double click it.

If you want to become more familiar with using the command line interface, you may read the articles listed under "The Command Line" in Apple's guide on using the terminal.

The simulation program has no graphic user interface, and all information/errors during the simulation run time is output through the terminal.

I hope this information helps!

Greatest Regards,
Ryan

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

I got this error
src/clscalarfield.h:28:14: fatal error: 'OpenCL/cl.hpp' file not found #include <OpenCL/cl.hpp>
I downloaded and installed the header file into the Xcode library folder. what's going on?

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

Wait does the cl.hpp need to be in the src folder with all the other header files??

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

I checked within MacOSX .sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers the cl.hpp file is there

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

But there is two files, cl.h and cl.hpp

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

The cl.hpp file should not go in the src/ folder. The cl.hpp file should be in the same folder as the cl.h file, so it sounds like it is in the right place. The problem seems to be that the compiler is not searching the OpenCL header directory.

Sorry, I'm not able to test anything right now, so I'm not able to give a solution to this error at the moment. What OS X version and Xcode version are you running?

You could try modifying the Makefile-OSX file to explicityly specify which directory to search for headers by replacing this line (line 4):

CXXFLAGS=$(OPTIMIZE) -std=c++11 -Wall

with this line:

CXXFLAGS=$(OPTIMIZE) -I"PATH_TO_HEADER_DIRECTORY" -std=c++11 -Wall

where PATH_TO_HEADER_DIRECTORY is the directory that contains the cl.hpp and cl.h files.

example:

CXXFLAGS=$(OPTIMIZE) -I"/Developer/SDKs/MacOSX <Version>.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers" -std=c++11 -Wall

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

Still not working even though I held its hand. At this point I am willing to give you remote access to my computer so you can fix this unless I made a simple mistake with a quick fix. Have you tried testing it on a brand new macbook pro retina 2015? (possibly do it in the apple store when no one is looking or something).
`Last login: Tue May 10 16:40:42 on ttys001
Roberts-MBP:~ rstolppi$ cd ~/Downloads/GridFluidSim3D-osx_build
Roberts-MBP:GridFluidSim3D-osx_build rstolppi$ make -f Makefile-OSX
c++ -O3 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers" -std=c++11 -Wall -c -o src/aabb.o src/aabb.cpp
c++ -O3 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers" -std=c++11 -Wall -c -o src/anisotropicparticlemesher.o src/anisotropicparticlemesher.cpp
c++ -O3 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers" -std=c++11 -Wall -c -o src/clscalarfield.o src/clscalarfield.cpp
In file included from src/clscalarfield.cpp:24:
src/clscalarfield.h:28:14: fatal error: 'OpenCL/cl.hpp' file not found
#include <OpenCL/cl.hpp>
^
1 error generated.
make: *** [src/clscalarfield.o] Error 1
Roberts-MBP:GridFluidSim3D-osx_build rstolppi$

`

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

Hello rtolps,

I am sorry that the program still will not build for you!

I am not very familiar with program distribution so I would not able to create a .dmg file to install this program. I am also not very familiar with the OS X operating system, so unfortunately I don't think I'd be able to solve this issue if I was given remote access to your machine.

There is one last thing you could try that comes to mind. Try replacing the same line as before with this line:

CXXFLAGS=$(OPTIMIZE) -F"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/" -std=c++11 -Wall

I believe that line will tell the compiler to search that specific framework directory in the case that it is not already looking there.

If you still get the same build error, I would suggest posting a question to Stack Overflow asking why the OpenCL/cl.hpp file cannot be found by the compiler.

Best Regards,
Ryan

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

IT WORKS OMG

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

Is there any chance you can make it so that I can export simulations from blender. Pls make like a python plugin or something for blender for easy import export. And change that code in the makefile to whatever you suggested to me because it worked like a charm. Now I got to figure out how to import the animation.

from gridfluidsim3d.

rtolps avatar rtolps commented on August 20, 2024

Another suggestion, I've mentioned Openvdb for particle meshing (it's much faster and has overall better results) but how about making the cache format the same as blender's "animated mesh" format for easier import through the El'Beem simulator. Even better, use alembic cache library for simulations (Blender will get support for it supposedly soon) in addition to the library for blender's animated mesh cache for fluids.

from gridfluidsim3d.

rlguy avatar rlguy commented on August 20, 2024

Hello rtolps,

I am very glad to hear that the program is building and running for you! I have updated the master branch with a FRAMEWORKSPATH variable that can be edited to add a directory to the compiler search path.

Thanks for the suggestions! I am currently not very experienced in using Blender, so I will have to look into these features and options in the future.

I will be closing this issue now that it has been solved.

Best Regards,
Ryan

from gridfluidsim3d.

melMass avatar melMass commented on August 20, 2024

Hello @rlguy

Do you have a way to make it work with the now cmake process on sierra ?

Thanks

from gridfluidsim3d.

gaaooee avatar gaaooee commented on August 20, 2024

Hello @melMass i've tried with the make file but can't get past a fatal error and it seems you've gotten installation to work a different way care to shed some insight on what exactly you did?

from gridfluidsim3d.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.