Compiling EMAN2 from GitHub source

281 views
Skip to first unread message

Christopher Lilienthal

unread,
Aug 2, 2016, 12:50:51 PM8/2/16
to EMAN2
Hello,

I tried to compile EMAN2 from source using the master branch on GitHub and encountered an error in util_sparx.cpp

$ cmake ../eman2
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for fseek64
-- Looking for fseek64 - not found
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for ftell64
-- Looking for ftell64 - not found
-- Looking for ftello
-- Looking for ftello - found
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/EMAN2_git/src/build

$ make
[…Excluding 205 lines of output...]
[ 66%] Building CXX object libEM/CMakeFiles/EM2.dir/sparx/util_sparx.o
[…Excluding 137 lines of output…]
/usr/local/src/EMAN2_git/src/eman2/libEM/sparx/util_sparx.cpp:26532: error: ‘fftwf_alloc_real’ was not declared in this scope
[…Excluding 3 lines of output…]
make[2]: *** [libEM/CMakeFiles/EM2.dir/sparx/util_sparx.o] Error 1
make[1]: *** [libEM/CMakeFiles/EM2.dir/all] Error 2
make: *** [all] Error 2


Should I not be using the master branch for compiling from source?

Thank you.

James Bell

unread,
Aug 2, 2016, 1:44:52 PM8/2/16
to EMAN2
I encountered this issue a few weeks ago. It turned out that my LD_LIBRARY_PATH was overwritten by another program I installed and needed to be reset. Could you try to place EMAN2 in your LD_LIBRARY_PATH (ahead of the other paths) and let us know whether it works?

Steven Ludtke

unread,
Aug 2, 2016, 1:49:08 PM8/2/16
to em...@googlegroups.com
To be clear, the EMAN2 binaries in particular were designed so they no longer required LD_LIBRARY_PATH. I believe the same is true of source. However, if you have some other program installed which does set LD_LIBRARY_PATH, this still overrides the other search behavior EMAN uses, and if one of the libraries in that path conflicts with the library EMAN is compiled against, you have problems. ie - if you installed a Relion binary which used it's own FFTW library with a similar version, but different compilation options, to the one installed on your system, then you compiled EMAN against the system library, the LD_LIBRARY path would still be pointing to Relion's FFTW and cause havoc (potentially for other programs as well, not just EMAN).

--
--
----------------------------------------------------------------------------------------------
You received this message because you are subscribed to the Google
Groups "EMAN2" group.
To post to this group, send email to em...@googlegroups.com
To unsubscribe from this group, send email to eman2+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/eman2

---
You received this message because you are subscribed to the Google Groups "EMAN2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eman2+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

----------------------------------------------------------------------------
Steven Ludtke, Ph.D.
Professor, Dept of Biochemistry and Mol. Biol.         (www.bcm.edu/biochem)
Co-Director National Center For Macromolecular Imaging        (ncmi.bcm.edu)
Co-Director CIBR Center                          (www.bcm.edu/research/cibr)
Baylor College of Medicine                             





Message has been deleted

Christopher Lilienthal

unread,
Aug 2, 2016, 6:32:28 PM8/2/16
to EMAN2
So the error is the compiler can’t find FFTW3?

My LD_LIBRARY_PATH when I received the error was:

echo $LD_LIBRARY_PATH
/usr/local/EMAN/lib:/usr/local/IMOD/lib


Okay so I reset my LD_LIBRARY_PATH to see if it would make a difference

export LD_LIBRARY_PATH=


I then removed all the previously generated cmake files in the build directory and gave it a shot again.  However, I received the same error.

If I run

ccmake ../eman2

it looks like the paths are set correctly.

FFTW3_INCLUDE_PATH  /usr/include
FFTW3_LIBRARY      
/usr/lib64/libfftw3f.so

and

ls -al /usr/lib64/libfftw3f.so
lrwxrwxrwx
. 1 root root 18 Jul 26 22:00 /usr/lib64/libfftw3f.so -> libfftw3f.so.3.2.3


I had thought since the paths are correct in cmake LD_LIBRARY_PATH wouldn’t be a factor.

Christopher Lilienthal

unread,
Aug 2, 2016, 6:41:02 PM8/2/16
to EMAN2
Thanks for the suggestion, I put the eman2 source directory in LD_LIBRARY_PATH and tried to recompile it but received the same error.
echo $LD_LIBRARY_PATH
/usr/local/src/EMAN2_git/src/eman2

Steve Ludtke

unread,
Aug 2, 2016, 7:00:52 PM8/2/16
to em...@googlegroups.com
Sorry, the LD_LIBRARY_PATH takes effect at runtime, not compile-time.  If building from source, you should have this (after compiling):

EMAN2DIR=$HOME/EMAN2
LD_LIBRARY_PATH=$EMAN2DIR/lib
PYTHONPATH=$EMAN2DIR/lib:$EMAN2DIR/bin

but this clearly isn't the problem you're having (a compilation problem). To me it appears that you might have the FFTW library installed, but not have the corresponding _devel package installed. ie- the include files are missing. You need to make sure that in ccmake or cmake :

FFTW3_INCLUDE_PATH               /usr/include                                                                                     
FFTW3_LIBRARY                    /usr/lib/x86_64-linux-gnu/libfftw3f.so                                                           

both of these point at appropriate targets. ie - in this case:
/usr/include/fftw3.h
should exist

----------------------------------------------------------------------------
Steven Ludtke, Ph.D.
Professor, Dept. of Biochemistry and Mol. Biol.                Those who do
Co-Director National Center For Macromolecular Imaging            ARE
Baylor College of Medicine                                     The converse
slu...@bcm.edu  -or-  ste...@alumni.caltech.edu               also applies
http://ncmi.bcm.edu/~stevel

Christopher Lilienthal

unread,
Aug 3, 2016, 10:14:47 AM8/3/16
to EMAN2
Thank you for the clarification.

I’ll preface this by saying I am running Red Hat Enterprise Linux Server release 6.8.

I have the following installed:
yum list installed | grep fftw
fftw
.x86_64                        3.2.1-3.1.el6           @rhel-x86_64-server-6
fftw
-devel.x86_64                  3.2.1-3.1.el6           @rhel-x86_64-server-6

and I have the fftw3.h file in /usr/include

ls /usr/include/ | grep fftw
fftw3
.f
fftw3
.h

Thank you for your help.

Steven Ludtke

unread,
Aug 3, 2016, 10:21:43 AM8/3/16
to em...@googlegroups.com
If you do an rpm -qa|grep -i fftw, do you have the EL6 equivalent of all of these ?

fftw-libs-double-3.3.3-8.el7.x86_64
fftw-libs-single-3.3.3-8.el7.x86_64
fftw-3.3.3-8.el7.x86_64
fftw-devel-3.3.3-8.el7.x86_64
fftw-libs-3.3.3-8.el7.x86_64
----------------------------------------------------------------------------
Steven Ludtke, Ph.D.

Christopher Lilienthal

unread,
Aug 3, 2016, 1:37:36 PM8/3/16
to EMAN2
Thanks for the packages.

As near as I can tell, I am missing
/usr/lib64/libfftw3_omp.so
/usr/lib64/libfftw3l_omp.so
/usr/lib64/libfftw3f_omp.so

and 

/usr/include/fftw3.f03
/usr/include/fftw3l.f03
/usr/include/fftw3q.f03

I don’t know if this is relevant at all but I opened my /usr/include/fftw3.h and could not find any mention of fftwf_alloc_real .

But according to http://www.fftw.org/doc/Memory-Allocation.html it exists so perhaps it is a version mismatch.

Steven Ludtke

unread,
Aug 3, 2016, 1:41:55 PM8/3/16
to em...@googlegroups.com
I think probably an FFTW compilation option issue? Maybe you should try compiling FFTW from source, and make sure you enable single-precision...

Christopher Lilienthal

unread,
Aug 3, 2016, 6:06:59 PM8/3/16
to EMAN2
Compiling FFTW from source and pointing the compiler to the files did the trick.

Thank you for your help.

angelawoo...@gmail.com

unread,
Sep 4, 2022, 10:08:49 PM9/4/22
to EMAN2
Hello,

I am trying to install EMAN2 with Conda on MacOS Monterey v12.5.1. I have followed the instructions step by step (https://blake.bcm.edu/emanwiki/EMAN2/COMPILE_EMAN2_ANACONDA). However, I got the same error when running "cmake" (see below). I compiled FFTW 3.3.10 from source but it still showed the same error. How should I work around this problem? 


(eman2) cs@cs-mbp build % cmake /Users/cs/eman2source/eman2

-- CMAKE_PREFIX_PATH="/Users/cs/opt/anaconda3/envs/eman2;/Users/cs/opt/anaconda3/envs/eman2/.."

-- Python3_EXECUTABLE="/opt/homebrew/Frameworks/Python.framework/Versions/3.10/bin/python3.10"

-- Python3_LIBRARIES="/opt/homebrew/opt/pyt...@3.10/Frameworks/Python.framework/Versions/3.10/lib/libpython3.10.dylib"

-- Python3_INCLUDE_DIRS="/opt/homebrew/opt/pyt...@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10"

-- Python3_SITELIB="/opt/homebrew/opt/pyt...@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages"

-- PYTHON_LIB_SHARED="0"

-- CMAKE_CXX_COMPILER_ID="AppleClang"

CMake Error at /Users/cs/opt/anaconda3/envs/eman2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):

  Could NOT find Boost (missing: python310 numpy310) (found version "1.74.0")

Call Stack (most recent call first):

  /Users/cs/opt/anaconda3/envs/eman2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)

  /Users/cs/opt/anaconda3/envs/eman2/share/cmake-3.24/Modules/FindBoost.cmake:2376 (find_package_handle_standard_args)

  cmake/Boost.cmake:5 (find_package)

  cmake/find_all.cmake:6 (include)

  CMakeLists.txt:81 (include)

-- Configuring incomplete, errors occurred!

See also "/Users/cs/eman2source/build/CMakeFiles/CMakeOutput.log".

See also "/Users/cs/eman2source/build/CMakeFiles/CMakeError.log".


Thanks,

Chen

Ludtke, Steven J.

unread,
Sep 4, 2022, 10:38:07 PM9/4/22
to em...@googlegroups.com
EMAN2 installations draw all of their dependencies from the Anaconda installation. While it looks like you have an anaconda environment active, your cmake output indicates that it is trying to draw some things (like python itself) from HomeBrew, rather than Anaconda. When you do 'conda activate EMAN2' it should be setting all of your environment variables to consistently point to Anaconda dependencies. If you wish to switch back to your non-Anaconda dependencies in that shell, you do a 'conda deactivate'.  This looks like you have somehow hybridized Anaconda with other settings, which won't work.  You should not be compiling any of the dependencies yourself...

--------------------------------------------------------------------------------------
Steven Ludtke, Ph.D. <slu...@bcm.edu>                      Baylor College of Medicine
Charles C. Bell Jr., Professor of Structural Biology        Dept. of Biochemistry 
Deputy Director, Advanced Technical Cores                   and Molecular Biology
Academic Director, CryoEM Core
Co-Director CIBR Center



shadow walker

unread,
Sep 4, 2022, 11:40:11 PM9/4/22
to em...@googlegroups.com
Try running cmake like below.

cmake /Users/cs/eman2source/eman2 -DPython3_EXECUTABLE=${CONDA_PREFIX}/bin/python

You may have to delete CMakeCache.txt before re-running cmake.




--
shadow_walker

angelawoo...@gmail.com

unread,
Sep 10, 2022, 11:58:24 PM9/10/22
to EMAN2
Thank you so much for your suggestion. I tried it and it worked well. Now I have EMAN2 installed. 

Thanks,
Chen

angelawoo...@gmail.com

unread,
Sep 11, 2022, 12:00:04 AM9/11/22
to EMAN2
Thank you for pointing that out. I forgot to check the "echo $PYTHONPATH" and it must had homebrew python in it previously.

Thanks,
Chen

Reply all
Reply to author
Forward
0 new messages