Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda: building mystran fails #83

Open
looooo opened this issue Jul 23, 2024 · 19 comments
Open

conda: building mystran fails #83

looooo opened this issue Jul 23, 2024 · 19 comments
Labels
building Related to building MYSTRAN

Comments

@looooo
Copy link

looooo commented Jul 23, 2024

I am running into this issue:

ninja: build stopped: multiple rules generate $SRC_DIR/Binaries/mod/allocated_memory_use_ifs.mod.

using this commands to build mystran:

cmake -G "Ninja" -B build -S . \
      -D CMAKE_BUILD_TYPE="Release" \
      -D CMAKE_INSTALL_PREFIX:FILEPATH=$PREFIX

ninja -C build install

not sure if this is a ninja error or if this is related to mystran.

@Bruno02468
Copy link
Collaborator

I've never built MYSTRAN with ninja. Since it builds correctly with make, it looks like the CMake generator for ninja detected two ways to generate the same .mod file. That makes no sense, since there's one and only one .mod file for each module, there shouldn't be more than one recipe for .mod files. There's no module that shares that file name, and I can't see any paths that could overlap in the CMake script making it see the same module twice... and that'd break building on make anyway.

I'm not familiar with ninja, but since it seems generator-specific, can't you build with make? We got instructions and everything (see BUILDING.md).

I don't know your workflow, but if you must use ninja, I suggest you take it to the CMake forums, because either the ninja generator has a bug or it needs additional/different options (be it in the invocation command or even non-breaking changes to the CMakeLists) to work. You need people that know ninja and can look at the build script to see what CMake is doing wrong.

@Bruno02468 Bruno02468 added the building Related to building MYSTRAN label Jul 23, 2024
@looooo
Copy link
Author

looooo commented Jul 23, 2024

Thanks for the fast resopnse!
Ninja is nice as it is available for all platforms. Would have been nice if the compilation worked with ninja. Also all the build systems failed with the same error for the different platforms (win, linux, osx) which is also very nice. I am more used to having different errors for all build-systems :)

I will try some other option and maybe come back to this issue if there are other build-problems.

@looooo
Copy link
Author

looooo commented Jul 24, 2024

I have some other questions:

  • Are there some tests to test the build?
  • what are the .mod (Binaries/mod) files for? Should they be included in the package?

@SteveDoyle2
Copy link
Collaborator

SteveDoyle2 commented Jul 24, 2024 via email

@looooo
Copy link
Author

looooo commented Jul 27, 2024

I am running these tests now:

mystran Build_Test_Cases/statics/bar_tube.bdf
mystran Build_Test_Cases/statics/cquad4_pcomp.bdf
mystran Build_Test_Cases/statics/cshear.bdf
mystran Build_Test_Cases/statics/ctria3_pshell_center.bdf
mystran Build_Test_Cases/statics/missing_continuation.bdf

but it fails with:

(%PREFIX%) %SRC_DIR%>mystran Build_Test_Cases/statics/cquad4_pcomp.bdf 
 Optional Initialization file: 
 MYSTRAN.INI
 does not exist. Internal defaults will be used instead.                        
 If you want to use the INI file, see the MYSTRAN Installation and Run Manual   

 MYSTRAN Version 15.2.0   Apr 07 2024 MYSTRAN developed by Dr Bill Case
At line 167 of file C:\bld\mystran_1722095065904\work\Source\MAIN\READ_INPUT_FILE_NAME.f90 (unit = 5, file = 'stdin')
Fortran runtime error: End of file

any ideas?

@SteveDoyle2
Copy link
Collaborator

SteveDoyle2 commented Jul 27, 2024 via email

@looooo
Copy link
Author

looooo commented Jul 29, 2024

so far I was succesfully in building mystran for linux64, osx64 and win. Now trying to cross compile for linux-aarch64 and osx-arm. On osx-arm I am running into this issue:

/bin/sh: /Users/runner/miniforge3/conda-bld/mystran_1722273029649/work/f2c/arithchk: Bad CPU type in executable

Seems like cross compiling is not really supported.

@looooo
Copy link
Author

looooo commented Jul 29, 2024

As far as I understand f2c should be a build-dependency, but as mystran downloads a version of f2c and does some custom builds of it, it's compiled for the wrong architecture and therefor failing. Any ideas how to fix this issue?

@SteveDoyle2
Copy link
Collaborator

SteveDoyle2 commented Jul 29, 2024 via email

@looooo
Copy link
Author

looooo commented Jul 29, 2024

no, I changed this to make / mingw32-make. Not using ninja anymore. Btw.: ninja is not a replacement for cmake.

So far the builds went fine and packages are available for osx64, linux64 and win [1].
What I am now trying, is to compile for osx-arm and linux-aarch64 [2] (you can see the azure-ci builds in the PR). Osx-arm needs to be cross-compiled because on azure it's not possible to build for osx-arm directly. But as mystran builds the tool f2c for osx-arm it's not possible to use this tool with osx64.
Not sure how to solve this. I saw that conda-forge has a f2c package [3]. But reading the mystran CMakeLists.txt I see that there is another binary (arithchk) build/used by mystran, so the conda-forge/f2c package is not an easy replacement.

add_executable(arithchk ${F2C_ARITHCHK_SRC})

[1] https://anaconda.org/conda-forge/mystran/files
[2] conda-forge/mystran-feedstock#1
[3] https://anaconda.org/conda-forge/f2c

@zchlrnr
Copy link
Collaborator

zchlrnr commented Jul 29, 2024

What exactly are you trying to do at the moment?
The initial issue ticket involved failing to compile via ninja, which wasn't a thing we'd thought of supporting.
If this is a ticket trying to expand the platforms supported, I think we should close this ticket and open a new one as a feature request perhaps?

@zchlrnr
Copy link
Collaborator

zchlrnr commented Jul 30, 2024

@looooo is there any chance you could provide a bit more information regarding the platforms you're trying to compile? We're very much interested in expanding our compilation support if you're interested in helping us do it.

@looooo
Copy link
Author

looooo commented Jul 31, 2024

Sure.

Conda is a package-manager for different platforms. Most packages are available for windows, linux-64, linux-aarch64 (arm-linux eg: rapberry-pi's), osx-64 and osx-arm (the new M1...M3 chips).

Another feature of the conda-packagemanager are the virtual-environments. So you can have for example two environments with the same packages but different versions. Often this is nice for comparing different dependency-versions. But I am not sure if this is interesting for mystran.

Why do I try to package mystran?
I have done a lot of conda-packaging in the past for FreeCAD and dependencies of FreeCAD. Now I saw that FreeCAD also supports mystran as a solver. While it's possible to use available builds of mystran and use it in freecad, I think it's better to have consistent compiler and dependencies. As FreeCAD is already packaged for conda, using the same tools to build mystran is in my mind a good idea.

How are packages build for conda?
Conda-packages are build with a tool called conda-build from repositories that are called feedstocks. The feedstock has all the scripts to build the packages on ci's (mainly azure is used, but it's possible to use other ci's too.) Basically you define all the necessary data in a file (meta.yaml [1]). optionally you can also use build-scripts [2, 3]. In the ci then conda-build builds the library installs it to a host-env and extracts all installed packages in a compressed file which than gets uploaded to anaconda.org.

If you have any questions, please let me know.

[1] https://github.com/conda-forge/mystran-feedstock/blob/main/recipe/meta.yaml
[2] https://github.com/conda-forge/mystran-feedstock/blob/main/recipe/build.sh
[3] https://github.com/conda-forge/mystran-feedstock/blob/main/recipe/bld.bat

@ceanwang
Copy link
Contributor

azure it's not possible to build for osx-arm directly. But as mystran builds the tool f2c for osx-arm it's not possible to use this >tool with osx64. Not sure how to solve this. I saw that conda-forge has a f2c package [3]. But reading the mystran >CMakeLists.txt I see that there is another binary (arithchk) build/used by mystran, so the conda-forge/f2c package is not an >easy replacement.

I build Mystran without using f2c. You may try that. f2c is for old Fortran compiler. Modern gFortran doesn't need it.

@looooo
Copy link
Author

looooo commented Jan 6, 2025

@ceanwang I am not sure how to build without f2c. Can you give some more information?

@ceanwang
Copy link
Contributor

You can try my CMakeLists.txt
https://github.com/ceanwang/MYSTRAN

@ceanwang
Copy link
Contributor

Have you solved the problem to build with ninja? I tried, got the same error.

@looooo
Copy link
Author

looooo commented Jan 14, 2025

dfd10a3

@ceanwang
Copy link
Contributor

OK. I updated my CMakeLists.txt. Now it can be build with Ninja under Windows 10's Ubuntu sub system.
But I still can't make Ninja working directly under Windows 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Related to building MYSTRAN
Projects
None yet
Development

No branches or pull requests

5 participants