# SMOKE compiled with GCC

**URL:** <https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735>\
**Category:** SMOKE\
**Created:** [October 23, 2021, 2:43pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735 "2021-10-23T14:43:01Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [October 23, 2021, 2:43pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/1 "2021-10-23T14:43:01Z")

</div>

Hello.  
I have downloaded SMOKE (v4.8.1 and v4.8) for GCC but they are compiled with the Intel compiler (the own tar file name indicates so). I checked, just in case, and the executables don’t work as they cannot find the libraries, which of course makes sense.  
Thanks.

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [October 23, 2021, 3:03pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/2 "2021-10-23T15:03:15Z")

</div>

Basically, to build SMOKE using _gcc/gfortran_:

- If you don’t have _gfortran_ installed, install it for your Linux distribution. (Note by the way that it is really the Fortran compiler which is significant for this, not the C compiler: different Fortran compilers (and sometimes even different versions of the “same” Fortran compiler) are generally not link-compatible…)
- Do the command _setenv BIN Linux2\_x86\_64gfort_ to set up the environment for building 64-bit _gcc/gfortran_ libraries and executables
- Install netCDF and I/O API libraries, as described in the I/O API installation instructions [https://cjcoats.github.io/ioapi/AVAIL.html#build](https://cjcoats.github.io/ioapi/AVAIL.html#build)
- Download the SMOKE source code, if necessary
- In the resulting SMOKE _subsys/smoke_ directory, do the command _mkdir $BIN_
- In the _subsys/smoke/src_ directory, adjust the _Makeinclude file_ for the locations of the installed libraries
- In the _subsys/smoke/src_ directory, do the command _make_

---

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [October 23, 2021, 8:55pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/3 "2021-10-23T20:55:14Z")

</div>

Hi @ **cjcoats** ,  
Thank you for your prompt answer. This starts the compilation although there is some problem with the linker and modbiog, which I have to troubleshoot. Will let you know if I have any further question.  
P.S. By GCC I meant GNU compiler collection, not the C compiler per se (yep, it’s usually confusing)

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [October 23, 2021, 9:02pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/4 "2021-10-23T21:02:52Z")

</div>

It would be useful to see that part of the _make_-output, starting with the command-line for the step that failed, together with all the output from it…

---

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [October 23, 2021, 9:26pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/5 "2021-10-23T21:26:10Z")

</div>

The output from the part that fails reads:

```auto
cd /home/centos/PREPRO/SMOKE/subsys/smoke/src/../Linux2_x86_64gfort11; /opt/praetorium/openmpi/bin/mpif90 -I/home/centos/ioapi-3.2/ioapi/fixed_src -I/home/centos/PREPRO/SMOKE/subsys/smoke/src/inc -I/home/centos/ioapi-3.2/Linux2_x86_64gfort11 -extend-source 132 -zero -O3 -fallow-argument-mismatch -fallow-invalid-boz -DAUTO_ARRAYS=1 -DF90=1 -DFLDMN=1 -DFSTR_L=int -DIOAPI_NO_STDOUT=1 -DNEED_ARGS=1 -c /home/centos/PREPRO/SMOKE/subsys/smoke/src/emmod/modbiog.f
gfortran: warning: 132: linker input file unused because linking not done
gfortran: error: 132: linker input file not found: No such file or directory
make: *** [Makefile:349: modbiog.o] Error 1

```

It seems like it compiles modbiog (it has the -c flag so it shouldn’t link at this point). However, it’s unclear (at least to me) what is trying to do with modbiog.o as there are still a bunch of other .f files to be compiled.

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [October 23, 2021, 10:06pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/6 "2021-10-23T22:06:45Z")

</div>

Somehow, there’s a missing “`-c`” flag in this compiler command: it should have

`.../opt/praetorium/openmpi/bin/mpif90 -c -I/home/centos/ioapi-3.2/ioapi/fixed_src...`

In your _Makefile_, the `.f.o` rule should have that `-c`; It should read

```auto

.f.o:
	cd ${OBJDIR}; ${FC} ${FFLAGS} -c $<

```

---

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [October 23, 2021, 11:03pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/7 "2021-10-23T23:03:28Z")

</div>

That rule is correctly defined with -c (it actually appears at the very end of the command line). Something else is triggering the error (will take a fresh look at it tomorrow).

---

<div class="post-metadata">

**Author:** ![eyth.alison](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@eyth.alison](https://forum.cmascenter.org/u/eyth.alison)\
**Post date:** [October 24, 2021, 11:47pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/8 "2021-10-24T23:47:45Z")

</div>

Did you try the package on the EPA FTP? I think they are statically compiled:

[https://gaftp.epa.gov/Air/emismod/2016/v2/smoke\_2016v2\_platform\_core\_01oct2021.zip](https://gaftp.epa.gov/Air/emismod/2016/v2/smoke_2016v2_platform_core_01oct2021.zip)

---

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [October 25, 2021, 6:11pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/9 "2021-10-25T18:11:04Z")

</div>

Hi @cjcoats.  
The problem was my own fault as I forgot to fix EFLAG. Thanks.

---

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [October 25, 2021, 6:13pm UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/10 "2021-10-25T18:13:17Z")

</div>

Hi @eyth.alison.  
I took a look at the link earlier this morning. You’re right in that they seem to be statically compiled. Will compare vs. my own compilation. Thanks.

---

<div class="post-metadata">

**Author:** ![afernandez](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@afernandez](https://forum.cmascenter.org/u/afernandez)\
**Post date:** [October 26, 2021, 12:09am UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/11 "2021-10-26T00:09:07Z")

</div>

Actually, I ran into an error while compiling:

```auto
/home/centos/PREPRO/SMOKE/subsys/smoke/src/smkinven/rdemspd.f:304:15:

  304 | LFIP = ''
      | 1
Error: Cannot convert CHARACTER(0) to INTEGER(4) at (1)
make: *** [Makefile:349: rdemspd.o] Error 1

/home/centos/PREPRO/SMOKE/subsys/smoke/src/smkinven/rdorlfr.f:493:15:

  493 | LFIP = ''
      | 1
Error: Cannot convert CHARACTER(0) to INTEGER(4) at (1)
make: *** [Makefile:349: rdorlfr.o] Error 1

```

LFIP is defined as an integer so the error makes sense. I was able to compile by simply substituting with `LFIP=0` but I have no clue if this is the intended use.

---

<div class="post-metadata">

**Author:** ![bbaek](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/bbaek/32/22_2.png) [@bbaek](https://forum.cmascenter.org/u/bbaek)\
**Post date:** [October 26, 2021, 12:35am UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/12 "2021-10-26T00:35:39Z")

</div>

That is a known bug and has been fixed for an upcoming release. You are correct. It should be set it to zero. LFIP=0.

---

<div class="post-metadata">

**Author:** ![gwangjin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/gwangjin/32/1336_2.png) [@gwangjin](https://forum.cmascenter.org/u/gwangjin)\
**Post date:** [December 2, 2021, 4:44am UTC](https://forum.cmascenter.org/t/smoke-compiled-with-gcc/2735/13 "2021-12-02T04:44:11Z")

</div>

Wow, thank you. I’ve succeeded in installing SMOKE 4.8.1 with AMD CPU.
