# Issues building the released version of PhoSim from BitBucket

**URL:** <https://www.rubin.community/t/issues-building-the-released-version-of-phosim-from-bitbucket/789>\
**Category:** Support\
**Tags:** build, phosim\
**Created:** [May 20, 2016, 2:38pm UTC](https://www.rubin.community/t/issues-building-the-released-version-of-phosim-from-bitbucket/789 "2016-05-20T14:38:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![josePhoenix](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@josePhoenix](https://www.rubin.community/u/josePhoenix)\
**Post date:** [May 20, 2016, 2:38pm UTC](https://www.rubin.community/t/issues-building-the-released-version-of-phosim-from-bitbucket/789/1 "2016-05-20T14:38:59Z")

</div>

I was trying to build the PhoSim package from [https://bitbucket.org/phosim/phosim\_release/wiki/Home](https://bitbucket.org/phosim/phosim_release/wiki/Home), but I’ve run into some issues. It seems like the package as released is not designed to be built on its own, or maybe I’m missing some files? I cloned the repo, `cd`'ed, and ran `make`. I got some errors about commands and files not being found. It looks like some variables used in the Makefile are not defined, and the `bin/setup` script that is perhaps supposed to set them is not found (because it is `.gitignore`'d).

I’m really just looking to create a single (highly oversampled) representative PSF for LSST for use in some data mocking, so if anyone has PhoSim installed and knows how to produce that, I’d be much obliged! (Of course, I’d like to be able to figure this out as well 🙂 )

Here’s the full output:

```auto
10:01:11 tanuki:deblend jlong$ git clone https://bitbucket.org/phosim/phosim_release.git
Cloning into 'phosim_release'...
remote: Counting objects: 19004, done.
remote: Compressing objects: 100% (5208/5208), done.
remote: Total 19004 (delta 13521), reused 18930 (delta 13472)
Receiving objects: 100% (19004/19004), 399.64 MiB | 3.75 MiB/s, done.
Resolving deltas: 100% (13521/13521), done.
Checking connectivity... done.
Checking out files: 100% (1167/1167), done.
10:08:18 tanuki:deblend jlong$ cd phosim_release/
ls
10:08:27 tanuki:phosim_release[master] jlong$ ls
COPYING data source
Doxyfile default_instcat test_integration
Makefile docs test_unit
README examples tools
ancillary focalplanelayout.txt validation
bin output validation.py
cleanup phosim validation_pipeline
condor phosim.py work
configure raytraceGPU
10:08:33 tanuki:phosim_release[master] jlong$ mate .
10:08:54 tanuki:phosim_release[master] jlong$ make
rm -f source/raytrace/*.o; rm -f source/trim/*.o; rm -f source/e2adc/*.o; rm -f source/instrument/*.o; rm -f source/atmosphere/*.o ; rm -f source/ancillary/*.o
csh -c "source bin/setup ; cd source/raytrace ; make; mv raytrace ../../bin/."
[1] 13974
bin/setup: No such file or directory.
make[1]: Entering directory '/astro/ferguson1/jlong/deblend/phosim_release/source/raytrace'
g -O3 -ffast-math -Wall -c -I -I -I ../ main.cpp -o main.o
make[1]: g: Command not found
Makefile:14: recipe for target 'main.o' failed
make[1]: [main.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ observation.cpp -o observation.o
make[1]: g: Command not found
Makefile:17: recipe for target 'observation.o' failed
make[1]: [observation.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ image.cpp -o image.o
make[1]: g: Command not found
Makefile:20: recipe for target 'image.o' failed
make[1]: [image.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ rng_mwc.cpp -o rng_mwc.o
make[1]: g: Command not found
Makefile:23: recipe for target 'rng_mwc.o' failed
make[1]: [rng_mwc.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ raytrace.cpp -o raytrace.o
make[1]: g: Command not found
Makefile:26: recipe for target 'raytrace.o' failed
make[1]: [raytrace.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ galaxy.cpp -o galaxy.o
make[1]: g: Command not found
Makefile:29: recipe for target 'galaxy.o' failed
make[1]: [galaxy.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ dust.cpp -o dust.o
make[1]: g: Command not found
Makefile:32: recipe for target 'dust.o' failed
make[1]: [dust.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ event.cpp -o event.o
make[1]: g: Command not found
Makefile:35: recipe for target 'event.o' failed
make[1]: [event.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ grating.cpp -o grating.o
make[1]: g: Command not found
Makefile:68: recipe for target 'grating.o' failed
make[1]: [grating.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ counter.cpp -o counter.o
make[1]: g: Command not found
Makefile:71: recipe for target 'counter.o' failed
make[1]: [counter.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ silicon.cpp -o silicon.o
make[1]: g: Command not found
Makefile:38: recipe for target 'silicon.o' failed
make[1]: [silicon.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ ../ancillary/readtext.cpp -o readtext.o
make[1]: g: Command not found
Makefile:74: recipe for target 'readtext.o' failed
make[1]: [readtext.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ surface.cpp -o surface.o
make[1]: g: Command not found
Makefile:41: recipe for target 'surface.o' failed
make[1]: [surface.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ coating.cpp -o coating.o
make[1]: g: Command not found
Makefile:44: recipe for target 'coating.o' failed
make[1]: [coating.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ perturbation.cpp -o perturbation.o
make[1]: g: Command not found
Makefile:47: recipe for target 'perturbation.o' failed
make[1]: [perturbation.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ obstruction.cpp -o obstruction.o
make[1]: g: Command not found
Makefile:59: recipe for target 'obstruction.o' failed
make[1]: [obstruction.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ screen.cpp -o screen.o
make[1]: g: Command not found
Makefile:50: recipe for target 'screen.o' failed
make[1]: [screen.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ medium.cpp -o medium.o
make[1]: g: Command not found
Makefile:53: recipe for target 'medium.o' failed
make[1]: [medium.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ air.cpp -o air.o
make[1]: g: Command not found
Makefile:56: recipe for target 'air.o' failed
make[1]: [air.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ chip.cpp -o chip.o
make[1]: g: Command not found
Makefile:65: recipe for target 'chip.o' failed
make[1]: [chip.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ contamination.cpp -o contamination.o
make[1]: g: Command not found
Makefile:62: recipe for target 'contamination.o' failed
make[1]: [contamination.o] Error 127 (ignored)
g -O3 -ffast-math -Wall -c -I -I -I ../ fea.cpp -o fea.o
make[1]: g: Command not found
Makefile:77: recipe for target 'fea.o' failed
make[1]: [fea.o] Error 127 (ignored)
main.o observation.o image.o rng_mwc.o raytrace.o galaxy.o dust.o event.o grating.o counter.o silicon.o readtext.o surface.o coating.o perturbation.o obstruction.o screen.o medium.o air.o chip.o contamination.o fea.o -g -O3 -ffast-math -Wall -I -L -lcfitsio -I -L -lfftw3 -lm -lz -o ./raytrace
make[1]: main.o: Command not found
Makefile:10: recipe for target 'raytrace' failed
make[1]: *** [raytrace] Error 127
make[1]: Leaving directory '/astro/ferguson1/jlong/deblend/phosim_release/source/raytrace'
mv: rename raytrace to ../../bin/./raytrace: No such file or directory
[1] + Done alias runidle python3.4 -m idlelib.idle
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1

```

---

<div class="post-metadata">

**Author:** ![danielsf](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/danielsf/32/440_2.png) [@danielsf](https://www.rubin.community/u/danielsf)\
**Post date:** [May 20, 2016, 3:25pm UTC](https://www.rubin.community/t/issues-building-the-released-version-of-phosim-from-bitbucket/789/2 "2016-05-20T15:25:05Z")

</div>

Hi Joseph,

I think you forgot to run ./configure in phosim’s home directory.

See the install instructions here

[https://bitbucket.org/phosim/phosim\_release/wiki/Using%20PhoSim](https://bitbucket.org/phosim/phosim_release/wiki/Using%20PhoSim)

---

<div class="post-metadata">

**Author:** ![josePhoenix](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@josePhoenix](https://www.rubin.community/u/josePhoenix)\
**Post date:** [May 20, 2016, 3:40pm UTC](https://www.rubin.community/t/issues-building-the-released-version-of-phosim-from-bitbucket/789/3 "2016-05-20T15:40:13Z")

</div>

Ah, how’d I miss that?! I swear I looked for a `./configure`… Anyway, much more interesting errors now:

> <https://gist.github.com/josePhoenix/2708b225c0d47fbdf30ad845c1fb9278>

---

<div class="post-metadata">

**Author:** ![josePhoenix](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@josePhoenix](https://www.rubin.community/u/josePhoenix)\
**Post date:** [May 20, 2016, 6:32pm UTC](https://www.rubin.community/t/issues-building-the-released-version-of-phosim-from-bitbucket/789/4 "2016-05-20T18:32:32Z")

</div>

All right, corrected with some tweaks to CFLAGS (per suggestion at [http://stackoverflow.com/questions/16352833/linking-with-clang-on-os-x-generates-lots-of-symbol-not-found-errors](http://stackoverflow.com/questions/16352833/linking-with-clang-on-os-x-generates-lots-of-symbol-not-found-errors)):

```auto
CFLAGS = -g -O3 -ffast-math -Wall -c -I${CFIO_INC_DIR} -I${FFTW3_INC_DIR} -I ../

```

becomes

```auto
CFLAGS = -stdlib=libc++ -g -O3 -ffast-math -Wall -c -I${CFIO_INC_DIR} -I${FFTW3_INC_DIR} -I ../

```
