-
Notifications
You must be signed in to change notification settings - Fork 42
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
Unclear how to create shared dynamic libraries on Windows #103
Comments
isnt that a dynamic lib ? |
Correct - but it's empty (0B). If you check the middle of the log you'll see that the part you contributed somehow doesn't compile because of "unknown options (/fpp etc) and "unresolved external symbols" (German translation). Just out of the blue, while my C is a bit rusty, is it possible that the header file is not found during the linking? The Fortran part seems to work out fine. |
weird, I dont see the fortran sources of primac being compiled, only prima.c, and also fortran flags seem incorrectly being passed to the cl C compiler: |
True. So the Fortran part seems to work so the differences between the make files could be it. @zaikunzhang I think you wrote the Fortran part - any ideas? You wrote a note in the Makefile that the exports must be treated differently, could that be something? Not sure how to debug this, I'd be very thankful for some explicit help 😄 no real experience with CMake unfortunately. |
Hi @dbischof90 , the CMake building system was by @jschueller, except that I made some minor revisions to the comments, only wordings. I am ignorant about CMake. I hope @jschueller will figure out the problem. Thank you. BTW, this may be a reminder that we should test both the shared and the static libraries in the CI. Do we have that already? In my experience, it has always been a good idea to make as many tests as possible, including some "unnecessary" tests (see the discussion on tests). Many problems and bugs have been spotted and fixed thanks to some "stupid" tests. If we don't have some tests like "oh that test, it is not needed, because I know it will pass", we are not testing sufficiently. That kind of test is more likely to surprise me, due to my limited knowledge, or because compilers/platforms do not behave as expected or even incorrectly (compilers have bugs, and PRIMA has revealed MANY). Maybe we are in such a situation again. Thanks. |
It could be that combining intel fortran and visual studio compiler is not possible because linker arguments and abi are not compatible, could you try using the intel C compiler instead ? It would involve changing the cmake generator, for example Ninja. |
On Windows, we need an import library (.lib) if we want to compile with MSVC. |
Okay, apologies, then I was indeed at the right address first. The tests did also help initially to figure out how to set up the Intel compiler for me, they also act as some form of documentation in the ideal case, which the maintainers achieved here very well so far. Having well-documented examples and tests on how to create shared libraries will help other people write diverse language wrappers too and the more systems they can target, the more coverage you can generate. |
So, I got a little further. I installed the Intel oneAPI C and Fortran compilers and, after setting the environment variables correctly (by using the "oneAPI command prompt", which sets the variables and paths accordingly (Windows...)) I could build at least. The first observation is that on Windows, according to https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2023-0/use-cmake-with-the-compiler.html, the only supported build tool for the oneAPI Intel compiler is Ninja. I installed that too and then got :: initializing oneAPI environment...
Initializing Visual Studio command-line environment...
Visual Studio version 16.11.28 environment configured.
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\"
Visual Studio command-line environment initialized for: 'x64'
: compiler -- latest
: debugger -- latest
: dev-utilities -- latest
: mpi -- latest
: tbb -- latest
:: oneAPI environment initialized ::
C:\Program Files (x86)\Intel\oneAPI>cd C:\MyWS\prima
C:\MyWS\prima>cmake -DCMAKE_INSTALL_PREFIX=install -GNinja -DBUILD_SHARED_LIBS=1 -B build -S .
-- The Fortran compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe - skipped
-- Assuming Intel symbol mangling
-- The C compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (2.7s)
-- Generating done (0.1s)
-- Build files have been written to: C:/MyWS/prima/build
C:\MyWS\prima>cmake --build build --target install
[65/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\consts.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\consts.F90" 2
------------------------------------------------------------------------------------^
[67/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\huge.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\huge.F90" 2
----------------------------------------------------------------------------------^
[70/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\inf.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\inf.F90" 2
---------------------------------------------------------------------------------^
[71/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\debug.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\debug.F90" 2
-----------------------------------------------------------------------------------^
[72/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\infnan.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\infnan.F90" 2
------------------------------------------------------------------------------------^
[76/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\memory.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\memory.F90" 2
------------------------------------------------------------------------------------^
[127/128] Install the project...
-- Install configuration: "Release"
-- Installing: C:/MyWS/prima/install/lib/primaf.lib
-- Installing: C:/MyWS/prima/install/bin/primaf.dll
-- Installing: C:/MyWS/prima/install/lib/primac.lib
-- Installing: C:/MyWS/prima/install/bin/primac.dll
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets-release.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config-version.cmake
-- Installing: C:/MyWS/prima/install/include/prima/mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/bobyqb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/checkexit_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/cobylb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/consts_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/debug_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/evaluate_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/fprint_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/getact_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/history_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/huge_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/infnan_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/infos_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/inf_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/linalg_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/lincob_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/memory_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/message_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/newuob_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/pintrf_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/powalg_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/preproc_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/ratio_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/redrho_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/rescue_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/selectx_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/shiftbase_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/string_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/univar_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/uobyqb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/xinbd_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/prima.h That gave me (besides some warnings) two non-empty So it seems that
Not so easy apparently. |
It looks fine, you can try to compile and run the tests to be sure |
So I can now at least confirm that your example successfully compiles! Starting from a "clean slate": C:\MyWS\prima>cmake -DCMAKE_INSTALL_PREFIX=install -GNinja -DBUILD_SHARED_LIBS=OFF -B build -S .
-- The Fortran compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe - skipped
-- The C compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (2.9s)
-- Generating done (0.0s)
-- Build files have been written to: C:/MyWS/prima/build
C:\MyWS\prima>cmake --build build --target install
[65/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\consts.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\consts.F90" 2
------------------------------------------------------------------------------------^
[67/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\huge.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\huge.F90" 2
----------------------------------------------------------------------------------^
[70/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\inf.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\inf.F90" 2
---------------------------------------------------------------------------------^
[71/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\debug.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\debug.F90" 2
-----------------------------------------------------------------------------------^
[72/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\infnan.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\infnan.F90" 2
------------------------------------------------------------------------------------^
[76/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\memory.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\memory.F90" 2
------------------------------------------------------------------------------------^
[127/128] Install the project...-- Install configuration: "Release"
-- Installing: C:/MyWS/prima/install/lib/primaf.lib
-- Installing: C:/MyWS/prima/install/lib/primac.lib
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets-release.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config-version.cmake
-- Installing: C:/MyWS/prima/install/include/prima/mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/bobyqb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/checkexit_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/cobylb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/consts_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/debug_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/evaluate_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/fprint_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/getact_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/history_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/huge_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/infnan_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/infos_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/inf_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/linalg_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/lincob_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/memory_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/message_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/newuob_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/pintrf_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/powalg_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/preproc_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/ratio_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/redrho_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/rescue_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/selectx_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/shiftbase_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/string_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/univar_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/uobyqb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/xinbd_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/prima.h
C:\MyWS\prima>cd c/examples/cobyla
C:\MyWS\prima\c\examples\cobyla>cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DPRIMA_DIR=./../../../install/lib/cmake/prima/ -GNinja
-- The C compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (1.4s)
-- Generating done (0.0s)
-- Build files have been written to: C:/MyWS/prima/c/examples/cobyla/build
C:\MyWS\prima\c\examples\cobyla>cmake --build build --target install
[2/3] Install the project...-- Install configuration: "Debug"
-- Installing: C:/MyWS/prima/c/examples/cobyla/install/bin/cobyla_example.exe
C:\MyWS\prima\c\examples\cobyla>C:/MyWS/prima/c/examples/cobyla/install/bin/cobyla_example.exe
Return from COBYLA because the trust region radius reaches its lower bound.
Number of function values = 35 Least value of F = -9.500855780525992E+000 Constraint violation = 0.000000000000000E+000
The corresponding X is: 2.990120684861312E+000 1.992427939779597E+000
The constraint value is:
-8.990120684861312E+000 -7.992427939779597E+000 -3.009879315138688E+000 -4.007572060220403E+000
-1.009879315138688E+000 -1.007572060220403E+000 -5.017451375359091E+000 -8.940919475015008E-002
x*={2.99012, 1.99243} f*=-9.50086 cstrv=0 nlconstr=-0.0894092 rc=0 msg='Trust region radius reaches its lower bound' evals=35 Note that I put My goal now is to make this accessible from C#. Hence if I put |
show us the logs |
Building with C:\MyWS\prima>cmake -DCMAKE_INSTALL_PREFIX=install -GNinja -DBUILD_SHARED_LIBS=1 -B build -S .
-- The Fortran compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe - skipped
-- Assuming Intel symbol mangling
-- The C compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (2.7s)
-- Generating done (0.0s)
-- Build files have been written to: C:/MyWS/prima/build
C:\MyWS\prima>cmake --build build --target install
[65/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\consts.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\consts.F90" 2
------------------------------------------------------------------------------------^
[68/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\huge.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\huge.F90" 2
----------------------------------------------------------------------------------^
[70/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\inf.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\inf.F90" 2
---------------------------------------------------------------------------------^
[71/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\debug.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\debug.F90" 2
-----------------------------------------------------------------------------------^
[72/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\infnan.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\infnan.F90" 2
------------------------------------------------------------------------------------^
[76/128] Building Fortran object fortran\CMakeFiles\primaf.dir\common\memory.F90.obj
fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\ppf.h(158): warning #5117: Bad # preprocessor line
# 2 "fortran\CMakeFiles\primaf.dir\common\C:\MyWS\prima\fortran\common\memory.F90" 2
------------------------------------------------------------------------------------^
[127/128] Install the project...-- Install configuration: "Release"
-- Installing: C:/MyWS/prima/install/lib/primaf.lib
-- Installing: C:/MyWS/prima/install/bin/primaf.dll
-- Installing: C:/MyWS/prima/install/lib/primac.lib
-- Installing: C:/MyWS/prima/install/bin/primac.dll
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets-release.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config.cmake
-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config-version.cmake
-- Installing: C:/MyWS/prima/install/include/prima/mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/bobyqb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/checkexit_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/cobylb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/consts_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/debug_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/evaluate_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/fprint_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/geometry_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/getact_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/history_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/huge_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/infnan_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/infos_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/inf_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/initialize_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/linalg_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/lincob_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/memory_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/message_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/newuob_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/pintrf_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/powalg_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/preproc_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/ratio_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/redrho_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/rescue_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/selectx_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/shiftbase_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/string_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/trustregion_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/univar_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/uobyqb_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_bobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_cobyla_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_lincoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_newuoa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/update_uobyqa_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/mod/xinbd_mod.mod
-- Installing: C:/MyWS/prima/install/include/prima/prima.h
PS C:\MyWS\prima> cd .\install\bin\
PS C:\MyWS\prima\install\bin> ls
Verzeichnis: C:\MyWS\prima\install\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 25.10.2023 15:20 68096 primac.dll
-a---- 25.10.2023 15:20 1745408 primaf.dll I now just try to load the PS C:\MyWS\prima\install\bin> ipython.exe
Python 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from ctypes import CDLL
...: import time
In [2]: import os
In [3]: lib = CDLL(os.path.join(os.getcwd(), 'primac.dll'))
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[3], line 1
----> 1 lib = CDLL(os.path.join(os.getcwd(), 'primac.dll'))
File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py:376, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
373 self._FuncPtr = _FuncPtr
375 if handle is None:
--> 376 self._handle = _dlopen(self._name, mode)
377 else:
378 self._handle = handle
FileNotFoundError: Could not find module 'C:\MyWS\prima\install\bin\primac.dll' (or one of its dependencies). Try using the full path with constructor syntax. I am definitely in the correct directory, hence my guess was that |
all prima dlls must be in PATH, try to load primaf.dll first |
Same issue. In [7]: lib = CDLL(os.path.join(os.getcwd(), 'primaf.dll'))
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[7], line 1
----> 1 lib = CDLL(os.path.join(os.getcwd(), 'primaf.dll'))
File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py:376, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
373 self._FuncPtr = _FuncPtr
375 if handle is None:
--> 376 self._handle = _dlopen(self._name, mode)
377 else:
378 self._handle = handle
FileNotFoundError: Could not find module 'C:\MyWS\prima\install\bin\primaf.dll' (or one of its dependencies). Try using the full path with constructor syntax. There's also the option to add DLL directories via https://docs.python.org/3/library/os.html#os.add_dll_directory but that did also not help. As you see from the output, it's also not really clear to me what's missing either. If you have some more pointers I'm happy to try out things and report back, I'm sure I'm not the only person who'd like to write a custom wrapper on Windows. I'd really prefer that over rewriting it all in C# 🫠 |
Hi @jschueller , have we tested shared libraries in our CI? If not yet, could we maybe add such tests? I suggest that all possibilities should be tested when introducing a new feature / component. This is nontrivial to do and it takes a lot of time, but it is what I have always tried to achieve during the development of PRIMA (see how many tests PRIMA has now). We should not expect that it can be done in one shot, but we should add new tests when we realize that something is missing. IMHO, it is normal that tests keep being augmented over time --- it is indeed quite abnormal if they remain the same after being introduced unless the development of the software has terminated. See also "What kind of tests are sufficient for the porting or translation of PRIMA?". cc: @emmt @amontoison @nbelakovski @ragonneau @Lht97 @OptHuang Thanks. |
yes, its the default mode, but we didnt test MS visual C / intel fortran combination |
Hi @dbischof90 , @jschueller (many thanks!) has added new CI tests for MS C compiler in combinations with intel fortran compilers: #105 . Could you check whether the configuration of the tests help you to configure the tool chain on your side? Thanks. |
Hi! Since I'm not very experienced yet in dotnet nor in windows programming in general, I will put this on the side for now and go with native reimplementation I found online (which I know will be inferior to this setup but I can't get it to run). Judging from the little code that the Julia wrapper consists of, it can't be difficult to write a wrapper library but I'm currently not able to figure out how to do this for Windows systems so this is ultimately unsuccessful for me. Thank you all for your help in this! |
Hi,
I'm currently trying to wrap PRIMA into a C# interface and, well, building is already an issue. :)
Judging from the CMakeFiles, I thought I'd only have to switch on
BUILD_SHARED_LIBS
but maybe I'm missing something.My output right now is
I've seen in #28 that this was discussed already, I suspect that I'm just not passing the correct build flags. Any ideas?
The text was updated successfully, but these errors were encountered: