The solution is quite simple, actually. 

When spack compiles libraries, it does not do that by using directly a 
compiler, but a script around the system compilers (or the user provided 
compiler) that cleans the environment, and makes sure everything is in place 
not to fiddle around with dependencies. 

Unfortunately, sometimes this compiler gets written in the final deal.II cmake 
files. Mac spack does it, ubuntu sometimes (not always).

The solution is the following:

Modify $(spack location -i dealii)/lib/share/cmake/deal.II/deal.IIConfig.cmake, 
around lines 109/110

    set(DEAL_II_CXX_COMPILER 
"/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++")
    set(DEAL_II_C_COMPILER 
"/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/gcc")

and make sure it becomes something like

    set(DEAL_II_CXX_COMPILER “the_real_path_to_mpicxx")
    set(DEAL_II_C_COMPILER "the_real_path_to_mpicc")

where “the_real_path_to_mpicxx” should be the path to the actual compiler you 
used to build deal.II.

I’m unsure why this happens. I think we should open an issue on spack.

L.


> On 21 Nov 2024, at 06:52, Vinayak Vijay <[email protected]> wrote:
> 
> It does use the spack compiler for the first "cmake .." (refer attached file 
> CMakeCache_first.txt) but for the second "cmake .." (refer attached file 
> CMakeCache_second.txt) it uses the path that i prescribe in the 
> CMakeFiles.txt. But then in the second case i face another issue i.e. the 
> linker issue mentioned as mentioned before.  
> 
> Thanks, Prof. Bangerth for taking a look at this. I am still writing about 
> the issue here in case anyone else can offer a solution.
> 
> Regards,
> Vinayak
> On Thursday, November 21, 2024 at 10:14:12 AM UTC+5:30 Wolfgang Bangerth 
> wrote:
> On 11/20/24 21:28, Vinayak Vijay wrote: 
> >   The C++ compiler 
> > 
> >     "/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++" 
> > 
> >   is not able to compile a simple test program. 
> 
> That means it's still using a compiler spack builds itself. 
> 
> As I mention, I don't know how spack works. I'm afraid that's the extent to 
> which I can help. 
> 
> Best 
> W. 
> 
> -- 
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see 
> https://groups.google.com/d/forum/dealii?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion visit 
> https://groups.google.com/d/msgid/dealii/3d7d1cde-ef18-4f8a-bb5d-70a7babd1774n%40googlegroups.com.
> <CMakeLists.txt><CMakeCache_first.txt><CMakeCache_second.txt>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/dealii/EE04AFD1-01A7-42D4-9A8E-205EF20044C9%40gmail.com.

Reply via email to