Repository: spack/spack

Issue:
variorum@0.4.1 %oneapi, %gcc build fails: ld: Intel/CMakeFiles/variorum_intel.dir/IvyBridge_3E.c.o:(.bss+0x0): multiple definition of `g_platform'
### Steps to reproduce the issue

Reproducible using:
* `spack@develop` (`08e75f7a3e02ef` from `Fri Aug 12 00:20:47 2022 -0700`)
* `ecpe4s/ubuntu20.04-runner-x86_64-oneapi:2022-07-01`
* `%oneapi@2022.1.0`

Same error using:
* `%gcc@11.2.0` on Ubuntu 22.04, x86_64

Concrete spec: [variorum.spec.json.txt](https://github.com/spack/spack/files/9330319/variorum.spec.json.txt)

Concretization:
```
==> Concretized variorum
 -   cbffblo  variorum@0.4.1%oneapi@2022.1.0~docs~ipo~log+shared build_type=Release arch=linux-ubuntu20.04-x86_64
[+]  vrfndhv      ^cmake@3.23.3%oneapi@2022.1.0~doc+ncurses+ownlibs~qt build_type=Release arch=linux-ubuntu20.04-x86_64
[+]  gvjgisz          ^ncurses@6.2%oneapi@2022.1.0~symlinks+termlib abi=none arch=linux-ubuntu20.04-x86_64
[+]  euvcz47              ^pkgconf@1.8.0%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  4455rwb          ^openssl@1.1.1q%oneapi@2022.1.0~docs~shared certs=mozilla patches=3fdcf2d arch=linux-ubuntu20.04-x86_64
[+]  tlqunsr              ^ca-certificates-mozilla@2022-07-19%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  g75tej4              ^perl@5.34.1%oneapi@2022.1.0+cpanm+shared+threads arch=linux-ubuntu20.04-x86_64
[+]  ahtnphg                  ^berkeley-db@18.1.40%oneapi@2022.1.0+cxx~docs+stl patches=b231fcc arch=linux-ubuntu20.04-x86_64
[+]  44yzgyw                  ^bzip2@1.0.8%oneapi@2022.1.0~debug~pic+shared arch=linux-ubuntu20.04-x86_64
[+]  uli7ace                      ^diffutils@3.8%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  sohfg2f                          ^libiconv@1.16%oneapi@2022.1.0 libs=shared,static arch=linux-ubuntu20.04-x86_64
[+]  mnowgf4                  ^gdbm@1.19%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  cd2lgld                      ^readline@8.1.2%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  5jz7ihy                  ^zlib@1.2.12%oneapi@2022.1.0+optimize+pic+shared patches=0d38234 arch=linux-ubuntu20.04-x86_64
[+]  7drxrmz      ^hwloc@2.8.0%oneapi@2022.1.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm+shared arch=linux-ubuntu20.04-x86_64
[+]  ky5qiaz          ^libpciaccess@0.16%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  5n46ly5              ^libtool@2.4.7%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  agucw5d                  ^m4@1.4.19%oneapi@2022.1.0+sigsegv patches=9dc5fbd,bfdffa7 arch=linux-ubuntu20.04-x86_64
[+]  q56bku4                      ^libsigsegv@2.13%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  iwdrk44              ^util-macros@1.19.3%oneapi@2022.1.0 arch=linux-ubuntu20.04-x86_64
[+]  go3fobe          ^libxml2@2.9.13%oneapi@2022.1.0~python arch=linux-ubuntu20.04-x86_64
[+]  ppl5hwa              ^xz@5.2.5%oneapi@2022.1.0+pic libs=shared,static arch=linux-ubuntu20.04-x86_64
[+]  pwztn54      ^jansson@2.14%oneapi@2022.1.0~ipo+shared build_type=RelWithDebInfo arch=linux-ubuntu20.04-x86_64
```

Install error:
```
==> Installing variorum-0.4.1-cbffblob2awnkywrfwkvkak5s65imx2g
==> No binary for variorum-0.4.1-cbffblob2awnkywrfwkvkak5s65imx2g found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/be/be7407b856bc2239ecaa27d3df80aee2f541bb721fbfa183612bd9c0ce061f28.tar.gz
==> No patches needed for variorum
==> variorum: Executing phase: 'cmake'
==> variorum: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16'

3 errors found in build log:
     168    ld: Intel/CMakeFiles/variorum_intel.dir/IvyBridge_3E.c.o:(.bss+0x0): multiple definition of `g_platform'; CMakeFiles/variorum.dir/config_architecture.c.
            o:(.bss+0x0): first defined here
     169    ld: Intel/CMakeFiles/variorum_intel.dir/Haswell_3F.c.o:(.bss+0x0): multiple definition of `g_platform'; CMakeFiles/variorum.dir/config_architecture.c.o:
            (.bss+0x0): first defined here
     170    ld: Intel/CMakeFiles/variorum_intel.dir/Broadwell_4F.c.o:(.bss+0x0): multiple definition of `g_platform'; CMakeFiles/variorum.dir/config_architecture.c.
            o:(.bss+0x0): first defined here
     171    ld: Intel/CMakeFiles/variorum_intel.dir/Skylake_55.c.o:(.bss+0x0): multiple definition of `g_platform'; CMakeFiles/variorum.dir/config_architecture.c.o:
            (.bss+0x0): first defined here
     172    ld: Intel/CMakeFiles/variorum_intel.dir/KabyLake_9E.c.o:(.bss+0x0): multiple definition of `g_platform'; CMakeFiles/variorum.dir/config_architecture.c.o
            :(.bss+0x0): first defined here
     173    ld: Intel/CMakeFiles/variorum_intel.dir/msr_core.c.o:(.bss+0x0): multiple definition of `g_platform'; CMakeFiles/variorum.dir/config_architecture.c.o:(.
            bss+0x0): first defined here
  >> 174    make[2]: *** [variorum/CMakeFiles/variorum.dir/build.make:196: variorum/libvariorum.so] Error 1
     175    make[2]: Leaving directory '/tmp/root/spack-stage/spack-stage-variorum-0.4.1-cbffblob2awnkywrfwkvkak5s65imx2g/spack-build-cbffblo'
  >> 176    make[1]: *** [CMakeFiles/Makefile2:279: variorum/CMakeFiles/variorum.dir/all] Error 2
     177    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-variorum-0.4.1-cbffblob2awnkywrfwkvkak5s65imx2g/spack-build-cbffblo'
  >> 178    make: *** [Makefile:139: all] Error 2
```

### Error message

<details><summary>Error message</summary><pre>
see above...
</pre></details>


### Information on your system

* **Spack:** 0.19.0.dev0 (d735c49b3217598e3a4432f6a6337916f57f730d)
* **Python:** 3.8.10
* **Platform:** linux-ubuntu20.04-cascadelake
* **Concretizer:** clingo

### Additional information

[spack-build-env.txt](https://github.com/spack/spack/files/9330316/spack-build-env.txt)
[spack-build-out.txt](https://github.com/spack/spack/files/9330317/spack-build-out.txt)

@rountree @slabasan @wspear

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
Thanks @eugeneswalker, we tagged a new release of variorum (and have another coming up later this month) that should resolve this error, I will get our package updated in spack after the release. Thank you for providing the build steps as well, so I can test at my end with the newer variorum package.
@tpatki keeping you in the loop here as well

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/variorum/package.py b/var/spack/repos/builtin/packages/variorum/package.py
--- a/var/spack/repos/builtin/packages/variorum/package.py
+++ b/var/spack/repos/builtin/packages/variorum/package.py
@@ -17,6 +17,8 @@ class Variorum(CMakePackage):
 
     maintainers = ["slabasan", "rountree"]
 
+    version("0.6.0", sha256="c0928a0e6901808ee50142d1034de15edc2c90d7d1b9fbce43757226e7c04306")
+    version("0.5.0", sha256="de331762e7945ee882d08454ff9c66436e2b6f87f761d2b31c6ab3028723bfed")
     version("0.4.1", sha256="be7407b856bc2239ecaa27d3df80aee2f541bb721fbfa183612bd9c0ce061f28")
     version("0.4.0", sha256="70ff1c5a3ae15d0bd07d409ab6f3c128e69528703a829cb18ecb4a50adeaea34")
     version("0.3.0", sha256="f79563f09b8fe796283c879b05f7730c36d79ca0346c12995b7bccc823653f42")
@@ -28,7 +30,6 @@ class Variorum(CMakePackage):
     ############
     variant("shared", default=True, description="Build Variorum as shared lib")
     variant("docs", default=False, description="Build Variorum's documentation")
-    variant("log", default=False, description="Enable Variorum's logs")
     variant(
         "build_type",
         default="Release",
@@ -78,11 +79,6 @@ def cmake_args(self):
         else:
             cmake_args.append("-DVARIORUM_DEBUG=OFF")
 
-        if "+log" in spec:
-            cmake_args.append("-DVARIORUM_LOG=ON")
-        else:
-            cmake_args.append("-DVARIORUM_LOG=OFF")
-
         if self.run_tests:
             cmake_args.append("-DBUILD_TESTS=ON")
         else:


Test patch: