3dem / relion

Image-processing software for cryo-electron microscopy
https://relion.readthedocs.io/en/latest/
GNU General Public License v2.0
453 stars 201 forks source link

Link error with multiple definition of 'timer' #677

Closed do-jason closed 4 years ago

do-jason commented 4 years ago

I have tried latest ver3.1 version with Intel compiler and got the below error during the linking while most of the executables are created.

../../lib/librelion_lib.a(renderEER.cpp.o):(.bss+0x0): multiple definition of `timer' ../../lib/librelion_lib.a(motioncorr_runner.cpp.o):(.bss+0x0): first defined here make[2]: *** [src/apps/CMakeFiles/run_motioncorr.dir/build.make:95: bin/relion_run_motioncorr] Error 1

I have checked src/renderEER.cpp and src/motioncorr_runner.cpp and these have the same "Timer timer;" class instance name. Changing the instance name of Timer class in src/renderERR.cpp will resolve this issue.

biochem-fan commented 4 years ago

Please don't enable #define TIMING globally by preprocesser flags. It should be enabled only in one file.

do-jason commented 4 years ago

Please don't enable #define TIMING globally by preprocesser flags.. It should be enabled only in one file.

It is globally enabled when CMAKE_BUILD_TYPE=Benchmarking was set. I love to use this build since there is almost no performance difference between "Release" and "Behchmarking" and "Benchmarking" gives some more detailed timing for each iteration. And as mentioned above, changing "Timer EERtimer" in renderEER.cpp file will resolve this issue.

In cmake/BuildTypes.cmake file, there is set(RELION_DEFINITIONS_BENCHMARKING "-DCUDA_BENCHMARK -DTIMING") statement.

biochem-fan commented 4 years ago

Please see https://github.com/3dem/relion/issues/587.

CMAKE_BUILD_TYPE=Benchmarking is no longer maintained and probably broken. If you can restore it (including GPU builds), please go ahead and send a pull request.

biochem-fan commented 4 years ago

Fixed by 667a2cb.

do-jason commented 3 years ago

@biochem-fan The above fix has typo in src/motioncorr_runner.cpp file.

ifdef TIMING_FFTW

MCtimer_fftw.printTimes(false);

endif

MCtimer_fftw should be timer_fftw since there is timer_fftw declaration which does not conflict with timer.