Skip to content

Conversation

@hmartinez82
Copy link
Contributor

@hmartinez82 hmartinez82 commented Jan 18, 2026

Requires #27437

@hmartinez82 hmartinez82 force-pushed the mumps_clang branch 2 times, most recently from 3aefd22 to b749515 Compare January 18, 2026 05:49
@ognevny
Copy link
Collaborator

ognevny commented Jan 18, 2026

I had atomic issue on CLANG* in #26410, but adding -latomic somehow fixed it (while resulting v8's exe segfaulted...)

edit: oops, that wasn't CLANG* issue...

@hmartinez82
Copy link
Contributor Author

hmartinez82 commented Jan 18, 2026

I tried -latomic with Flang and it says it doesn't exist . I looked, there's no libatomic.a in /clang64/lib :-( , unless it's in another package, but I don't know which :(

@ognevny
Copy link
Collaborator

ognevny commented Jan 18, 2026

unless it's in another package, but I don't know which :(

❯ pkgfile libatomic.a
mingw64/mingw-w64-x86_64-gcc
ucrt64/mingw-w64-ucrt-x86_64-gcc
msys/gcc
msys/mingw-w64-cross-mingw32-gcc
msys/mingw-w64-cross-mingw64-gcc
msys/mingw-w64-cross-mingwarm64-gcc
msys/mingw-w64-cross-ucrt64-gcc

@hmartinez82
Copy link
Contributor Author

hmartinez82 commented Jan 18, 2026

@ognevny but none of them have the -clang- prefix, right? I found all those too, with pkgfile. And I would need for ARM64 anyway.

@ognevny
Copy link
Collaborator

ognevny commented Jan 18, 2026

@ognevny but none of them have the -clang- prefix, right? I found all those too, with pkgfile. And I would need for ARM64 anyway.

yes, none of clang packages has libatomic

@hmartinez82
Copy link
Contributor Author

Well, once this #27437 is done, I got mumps building for clang64 and clangarm64 :)

@MehdiChinoune MehdiChinoune marked this pull request as ready for review January 18, 2026 17:48
@ognevny
Copy link
Collaborator

ognevny commented Jan 18, 2026

well, not all dependencies seem to be satisfied (from CLANG64 log):

	msmpi.dll => not found

@MehdiChinoune
Copy link
Collaborator

well, not all dependencies seem to be satisfied (from CLANG64 log):

	msmpi.dll => not found

The official msmpi should be installed by the user manually, mingw-w64-msmpi contains just import libraries.

@hmartinez82 hmartinez82 force-pushed the mumps_clang branch 2 times, most recently from 9688444 to b04a664 Compare January 20, 2026 06:18
@mmuetzel
Copy link
Collaborator

Maybe, I'm reading the changes wrong. But would it even be possible to link to the dll with these changes to the pkg-config files?

@hmartinez82 hmartinez82 force-pushed the mumps_clang branch 2 times, most recently from 89edc3b to 636f91f Compare January 20, 2026 06:23
@hmartinez82
Copy link
Contributor Author

hmartinez82 commented Jan 20, 2026

@mmuetzel Yeah, I see what you are saying, the changes are actually much easier. I'll fix it. I saw all those .a files and thought that this was build statically, but it's a DLL.

Would linking to the output of -Wl,--out-implib be enough?

@hmartinez82
Copy link
Contributor Author

Maybe, I'm reading the changes wrong. But would it even be possible to link to the dll with these changes to the pkg-config files?

It appears that the pkgconf file originally only had the static libraries, right?

Cflags: -I\${includedir} -I\${includedir}/mumps/mpi_seq
Libs.private: -fopenmp -lmumps-${x}to -lesmumps ${_fc_libs}
Libs: -lmumps-${x}to
Libs: -lmumps-${x}to.dll
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that mean that you would link to the dll and the static archives if you query the static linker flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I'm asking, I'm very sorry. I'm not a pkgconf guy :(.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hmartinez82 Please remove that extra .dll, It does not serve any purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so I tested. and yes you are right, --static includes both Libs.Private and Libs

What should I do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.dll removed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous flags are correct. If you'd like to link statically, you'd add -static to the flags for the linker driver, and it would prefer static archives (*.a) over import libraries (*.dll.a) or dlls.

So, the goal should be that there is (at least) one static library with the same base name as the shared library (dll).

If I understand correctly, that didn't work with the LLVM toolchain because it can't create thin archives.

One possible way to work around that (untested) could be to manually extract all objects from the existing archives and create a new archive using something like this:

  for x in c z s d; do
    mkdir tmp-mumps-${x}so
    cd tmp-mumps-${x}so
    ar x ../lib${x}mumps_seq.a
    ar x ../libmumps_common_seq.a
    ar x ../libmumps_pord.a
    ar x ../libmumps_mpi_seq.a
    ar crs ../libmumps-${x}so.a *.o
    cd ..
    rm -rf tmp-mumps-${x}so

    mkdir tmp-mumps-${x}to
    cd tmp-mumps-${x}to
    ar x ../lib${x}mumps_shm.a
    ar x ../libmumps_common_shm.a
    ar x ../libmumps_pord.a
    ar x ../libmumps_mpi_seq.a
    ar crs ../libmumps-${x}to.a *.o
    cd ..
    rm -rf tmp-mumps-${x}to

[your commands to create the dlls go here]

    if [[ ${CARCH} == x86_64 ]]; then
      mkdir tmp-mumps-${x}mo
      cd tmp-mumps-${x}mo
      ar x ../lib${x}mumps_mpi.a
      ar x ../libmumps_common_mpi.a
      ar x ../libmumps_pord.a
      ar crs ../libmumps-${x}mo.a *.o
      cd ..
      rm -rf tmp-mumps-${x}mo

[your commands to create the dll go here]
    fi
  done

I guess llvm-ar would be able to do that. But I haven't tested that yet.

If that works, it shouldn't be necessary to change the pkg-config files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llvm-ar can create thin archives from, but not from other archives. The issue is that lib${x}mumps_seq.a, libmumps_common_seq.a, etc are already archives themselves.

Copy link
Collaborator

@mmuetzel mmuetzel Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llvm-ar can create thin archives from, but not from other archives. The issue is that lib${x}mumps_seq.a, libmumps_common_seq.a, etc are already archives themselves.

This is why I was suggesting to extract the objects from the static libraries (with ar x) and then recreating the static library (with the correct name) from the extracted object files.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested that approach in the MINGW64 and the CLANG64 environment. And it seems to be working.
The package size would increase because we'd essentially distribute the objects twice in different archives. But it should behave identically for anyone that is linking to the installed binaries.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could probably also add an empty archive with the base name of the dll and add the actual archives to the Libs.private line in the pkg-config file.

@mmuetzel
Copy link
Collaborator

It appears that the pkgconf file originally only had the static libraries, right?

No. It had both.

The flags in the lines with *.private are returned by pkg-config additionally to the "normal" flags if you ask it for the flags for static linking.

@mmuetzel
Copy link
Collaborator

Looking the build artifacts that make creates, there are the two archives libmpiseq_seq.a and libmpiseq_shm.a which apparently aren't used for the dll or the installed static libraries.
Is that intentional? Or are they missing?
Should they be linked into the respective libraries (instead of or additionally to libmumps_mpi_seq.a)?

@hmartinez82
Copy link
Contributor Author

@mmuetzel That I don't now :-( . I think that that's something only the project devs would be able to answer. I've tried to stay as close as possible to the original package recipe.

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

Successfully merging this pull request may close these issues.

4 participants