svenreiche / Genesis-1.3-Version4

Time-dependent, 3D Code to simulate the amplification process of a Free-electron Laser.
GNU General Public License v3.0
54 stars 27 forks source link

Compilation Error : Linking the build files in a MacBook Pro with ARM64-M1 architecture gives 1 error #81

Open Garzik opened 1 year ago

Garzik commented 1 year ago

First try : using libc++ improve fixing but Ii is still not enough (see attached file) Issue_Compile_GENESIS_M1.pdf

svenreiche commented 1 year ago

Hi David,

can you try the following: Comment out line 9 in CMakeLists.txt and reload the project. This command causes that the library stdc++ is linked to the executable, which in your case is not found. It was there mostly for backward compability and myself I do not need it for compilation. It really depends on how h5pcc or other compilers are configured on the local system. In mor emodern times the compiler command is a wrapper which has the equivalent library already in its command line (such as h5pcc has already the mpi and hdf5 libraries included).

Best Sven

PS: I need to fix the sprintf as well :)

Garzik commented 1 year ago

Hi Sven, I tried as you suggested, but I got mainly the same results. The attached file is 26 pages long, nevertheless I think that the major bug's information are in the first and last screenshot> What it is strange to me is that I installed the HDF5 and MPI libraries with the last update of MacPorts for Monterey OS, thus the ARM64 architecture is taken into account enthuse releases. Here you are :

Bugs_linking_Genesis _MacOS_Try2.pdf

Thanks a lot.

Best.

David

svenreiche commented 1 year ago

Hi David, can you try to change in the cmakelist.txt the library from libstdc++ to libc++. Apparently uses xcode a different library (see more information here: https://developer.apple.com/forums/thread/113746)

Myself I used clion of mac to compile and it works.

Hope this solves it

Best Sven

Garzik commented 1 year ago

Hi Sven, I tried by changing that line > Result is almost the same, in the sense that it did not find the libc++, even if this is really present. Probably I have to modify an environmental variable, but I do not know which one. thank you so much, Cheers,

David Genesis_compiling_issue.pdf

svenreiche commented 1 year ago

Hi David, I had a chance to compile genesis on macos (Venture). I still have to polish it but it seems to work for me. Here is what I did: 1) Installing cmake for mac and enabling the command line call of cmake (it is part of the app) 2) Installing openmpi in my local directory $HOME/opt/usr/local. The compiler are mpicc and mpicxx 3) Installing hdf5 with parallel support (openmpi) in $HOME/opt/usr/local as well 4) Installing fftw3 with paralle support in $HOME/opt/usr/local as well 5) Clone the geneis 4 dev branch from github 6) Editing the CMakeList.txt to make it work (quick and dirty - needs a better implementation 7) Make a build directory, go into in and type "cmake .." 8) Type "make"

To make CMakeList.txt work I changed following things in the file: 1) I explicitly set the compiler path with if (EXISTS "/Users/reiche/opt/usr/local/bin/h5pcc) set(CMAKE_CXX_COMPILER /USer/reiche/opt/usr/local/bin/h5pcc) endif()

Note that the path might differ on your computer.

2) I disabled everything from the line #check for FFTW libraries... till the endif()

3) After the include_directories statement I added: include_directories(/Users/reiche/opt/usr/local/include)

4) After "# add optioal macro definition" I enforced the macro definitiontarget_compile_definitions(genesis13 PRIVATE FFTW=1)

5) in the last line with target_link_libraries I added the library fftw3 target_link_libraries(genesis4 genesis13 ${_libraries} fftw3)

It still needs a lot of clean up to make CMakeList.txt work on different platforms without editing them by hand, but the good news is that it can be done on macos x

Best Sven

Garzik commented 1 year ago

Dear Sven,

Thank you very much for your reply and for your effective efforts. I am not yet able to try your solution, because in conformity with the Sincrotrone IT group policy, I have to ask if the MacOS upgrade to Ventura is allowed on our MacbookPro. I would have answer by Tuesday (for someone’s here is still vacations time). I could try on Monterey OS, but I saw that the CMake app underwent an upgrade for Ventura, thus I prefer to wait for trying with the same conditions as you.

I will keep you informed. Thanks a lot.

David

Il giorno 4 set 2023, alle ore 16:51, Sven Reiche @.***> ha scritto:

Hi David, I had a chance to compile genesis on macos (Venture). I still have to polish it but it seems to work for me. Here is what I did:

Installing cmake for mac and enabling the command line call of cmake (it is part of the app) Installing openmpi in my local directory $HOME/opt/usr/local. The compiler are mpicc and mpicxx Installing hdf5 with parallel support (openmpi) in $HOME/opt/usr/local as well Installing fftw3 with paralle support in $HOME/opt/usr/local as well Clone the geneis 4 dev branch from github Editing the CMakeList.txt to make it work (quick and dirty - needs a better implementation Make a build directory, go into in and type "cmake .." Type "make" To make CMakeList.txt work I changed following things in the file:

I explicitly set the compiler path with if (EXISTS "/Users/reiche/opt/usr/local/bin/h5pcc) set(CMAKE_CXX_COMPILER /USer/reiche/opt/usr/local/bin/h5pcc) endif() Note that the path might differ on your computer.

I disabled everything from the line #check for FFTW libraries... till the endif()

After the include_directories statement I added: include_directories(/Users/reiche/opt/usr/local/include)

After "# add optioal macro definition" I enforced the macro definitiontarget_compile_definitions(genesis13 PRIVATE FFTW=1)

in the last line with target_link_libraries I added the library fftw3 target_link_libraries(genesis4 genesis13 ${_libraries} fftw3)

It still needs a lot of clean up to make CMakeList.txt work on different platforms without editing them by hand, but the good news is that it can be done on macos x

Best Sven

— Reply to this email directly, view it on GitHub https://github.com/svenreiche/Genesis-1.3-Version4/issues/81#issuecomment-1705399181, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ6GOPKPVYV7NHKEHLMLQPTXYXTHFANCNFSM6AAAAAAXL7QHOE. You are receiving this because you authored the thread.