Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux install? #1

Closed
twanito opened this issue Sep 21, 2017 · 22 comments
Closed

Linux install? #1

twanito opened this issue Sep 21, 2017 · 22 comments

Comments

@twanito
Copy link

twanito commented Sep 21, 2017

Hi, I'm interested in running daysim on linux for the purposes of putting it in a docker container. Very happy to contribute set up and image once done but was wondering how I should go about installing Daysim for linux (ubuntu preferably)? I've seen the question asked on forums and have seen some discussions about using linux to run some parametric studies but not seen any information concerning how to go about this. Any help much appreciated!

Antoine

@nljones
Copy link
Member

nljones commented Sep 21, 2017

Hi Antoine,

From this source code repository, you can build Daysim for Linux. I recommend using CMake. The program rtrace_dc is currently not built automatically. To create it, you need to set the DAYSIM flag in CMake, build rtrace, and then rename the rtrace program to rtrace_dc.

Nathaniel

@twanito
Copy link
Author

twanito commented Sep 24, 2017

Great, thanks for the help Nathaniel. I've made some headway with this install. I am however unsure about how successful my build was. I used cmake to build the project (no errors flag up except for qt5 not being found, which I'm not too fussed about).

Once everything is configured I run "make" and the following error occurs.
image

I ran "make -i" instead and most of the commands got built (I think).
image

In fact, it even seems that rtrace was built despite your mention of having to set this up separately. I renamed it rtrace_dc and then ran my test but I get this error:
image

Any idea if this might be an install issue or rather an issue with my file set up? If you're curious and want to try a debug I have uploaded the docker image to: antoinedao/daysim:dev

Thanks again for the help.

Antoine

@twanito
Copy link
Author

twanito commented Sep 24, 2017

PS: I also moved a bunch of lib files from my windows distributions of radiance and daysim into this docker image as I couldn't find them when installing from this repo + "apt-get install radiance".

@nljones
Copy link
Member

nljones commented Sep 24, 2017

The error you received in your make command is from not having libtiff. There are instructions on the main page for buiding libtiff for Windows, and I imagine that you could do something similar for Linux, but the resulting programs (pabop2xyz and ra_tiff) are not critical to Daysim.

You need to set the DAYSIM flag in CMake to avoid the error you got in your test. Basically, rtrace and rtrace_dc are two separate programs that share significant overlap in source code. Setting the DAYSIM flag switches the build process from one to the other. Currently this is not automated, and the default is to build rtrace, not rtrace_dc.

Nathaniel

@twanito
Copy link
Author

twanito commented Sep 25, 2017

I'm really sorry to drag this on further than it needs to be but I'm not super familiar with cmake. My understanding is that I need to set the DAYSIM flag when creating the Daysim project. Is this done by adding some lines to the CMakeLists.txt file or rather by passing a command when running "cmake" in bash?

@nljones
Copy link
Member

nljones commented Sep 25, 2017

Either is possible. In CMakeLists.txt, you can add add_definitions(-DDAYSIM). Or you could invoke CMake with cmake -DDAYSIM <path to sources>. These are both equivalent to adding #define DAYSIM to the beginning of every source file.

Note that this only applies to compiling rtrace_dc. For all other programs, this will either have no effect or create junk.

@prafiles
Copy link

Hey guys, did you get it work? I have just been interested in the project,

@MarcoManzan
Copy link

diff.txt
thanks to the sugestions of Nathaniel I've successfully compiled Daysim in Windows and Linux. I had to modify the source in some parts. Some changes are only required on Linux, I generated a diff patch diff.txt included here.

I compiled Daysim on a kubuntu 16.04 server, to generate the makefiles I used ccmake. I put the source in directory "Daysim", I create directory "build", then in build (cd build ) I issued the command ccmake ../Daysim. This opens an ncurses interfaces. check that the "BUILD_HEADLESS" option is "ON", then configure with key "c", generate Makefiles with key "g". Then you can build Daysim with "make".
at the end I renamed the binary file bin/rtrace to bin/rtrace_dc
"mv bin/rtrace bin/rtrace_dc"

I hope this helps

@nljones
Copy link
Member

nljones commented Jan 9, 2018

Some of these changes have been made in the latest commit.

Make sure that you are compiling from the "combined" branch.

@MarcoManzan
Copy link

dear nljones, I apologize. I applied commits, but now I have a problem with cmake command "install_without_extension" in src/daysim. I replaced it replicating the install command for WIN32 above.
Furthermore I added in CMakeList.txt the line
set(CMAKE_CXX_FLAGS "-std=c++11")
now it compiles without problems in Linux

@nljones
Copy link
Member

nljones commented Jan 9, 2018

Can you show the specific errors you receive when you run CMake? I'm not able to find "install_without_extension" in src/daysim, and c++11 hasn't generally been needed for Radiance.

@MarcoManzan
Copy link

the problems are linux specific, if you compile in windows no patch is required, c++11 is required when compiling climateFile.cpp line 246 " auto res = m_ptIdh[pointer] + diff*ratio;" g++ ( I'm using gcc version 5.4.0 ) requires the option to compile the "auto" keyword.
install_without_extension is used in src/util/CMakeLists.txt line 164 inside an if-else statement. I add the generated patch.
diff2.txt

@nljones
Copy link
Member

nljones commented Jan 9, 2018

The CMake command "install_without_extension" is part of the Radiance distribution. Please bring up this issue with them.

@MarcoManzan
Copy link

macro "install_without_extension" is a macro defined inside radiance tree inside src/CMakefile.txt

macro(install_without_extension)
foreach(file IN ITEMS ${ARGN})
string(REGEX REPLACE "\.[^.]*$" "" file_we ${file})
install(PROGRAMS "${file}"
DESTINATION "bin"
RENAME "${file_we}"
)
endforeach()
endmacro()

adding the macro to src/CMakeLists.txt solves the problem
CMakeLists.txt

@nljones
Copy link
Member

nljones commented Jan 10, 2018

The latest commit includes the new Radiance CMake files. Note that "master" is now the main branch of Daysim. The "combined" branch will no longer be updated.

@jimenofonseca
Copy link

jimenofonseca commented Jan 16, 2018

Hi @MarcoManzan I wonder if you can give us an overview of the steps you undertook to get Daysim running in your Ubuntu. I assume we can use the master branch for this. I much appreciate it!.

@MarcoManzan
Copy link

install ccmake
apt-get install cmake-curses-gui
git clone https://github.com/MITSustainableDesignLab/Daysim.git
cd Daysim
git remote add upstream https://github.com/NREL/Radiance.git

edit CMakelist.txt end add somewere the following line
add_definitions(-DDAYSIM)

change directory and create a build directory
cd ..; mkdir build; cd build

run ccmake
ccmake ../Daysim

configure the project by typing "c". Some errors are issued, press "e" to exit
position the cursor on "BUILD HEADLESS" and press "Enter" so the menu appears as below:
BUILD_HEADLESS *ON
move the cursor to "CMAKE_INSTALL_PREFIX " press "Enter" and type the installation directory such as $HOME/Daysim path press "Enter"
type "c" again
type "g" to generate
ccmake exits then compile and install
make
make install

daysim executables are not installed in destination directory, to install uncomment the last line of the fie ../Daysim/src/daysim/CMakeLists.txt
the last stem is to rename rtrace:
cd $HOME/Daysim/bin
mv rtrace rtrace_dc

@nljones
Copy link
Member

nljones commented Jan 17, 2018

To amend @MarcoManzan's instructions, use add_definitions(-DDAYSIM) only to compile rtrace_dc. This definition may break other programs. A better solution is to use target_compile_definitions instead.

Also, if you follow the directions, rtrace_dc should be created in $HOME/build/bin, not $HOME/Daysim/bin. It is generally not recommended to place the bin directory within the git project directory.

@MarcoManzan
Copy link

I added the line
target_compile_definitions(radiance PRIVATE -DDAYSIM)
in Daysim/src/rt/CMakeLists.txt
and it compiles, but I suspect the result is the same than adding "add_definitions(-DDAYSIM)".
About the second remark I agree, but I was not clear in defining the directories. I compile the source in
/home/marco/Source/Daysim using two directories /home/marco/Source/Daysim/Daysim and /home/marco/Source/Daysim/build, then I install binaries and libraries in /home/marco/Daysim resulting in two directories /home/marco/Daysim/bin and /home/marco/Daysim/lib. Any other directories for installing binaries and libraries could be used.

@nljones
Copy link
Member

nljones commented Jan 17, 2018

Thanks for the clarification. I suspect the target_compile_definitions with -DDAYSIM would also need to be applied to the rtrace_dc target, and of course building the radiance library with -DDAYSIM would only apply to rtrace_dc, not to other uses of the radiance library. Radiance wasn't really designed to support this kind of customization (part of the reason why compiling rtrace_dc remains a manual process).

@MarcoManzan
Copy link

At the moment I see only a solution: building daysim in two steps:
with -DDAYSIM compile and install, copy rtrace to rtrace_dc
without -DDAYSIM compile and install

@jimenofonseca
Copy link

Thank you very much @MarcoManzan and @nljones .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants