Coder Social home page Coder Social logo

Comments (10)

Ziaeemehr avatar Ziaeemehr commented on August 15, 2024 1

On Ubuntu to build the static library for wavelib:

git clone [email protected]:rafat/wavelib.git
cd wavelib
mkdir -p build
cd build
cmake ../
cp Bin/* /copy_to_directory_of_installation_fCWT/src/libwavelib/

then continue with the installation of fCWT

cd fCWT/build
cmake ..

now all the dependencies are found:

Build type is Release
Building of shared library is enabled.
/home/ziaee/prog/install_files/fCWT
STATUS OF LIBRARY: FFTW: [/usr/lib/x86_64-linux-gnu/libfftw3f.so]
STATUS OF LIBRARY: FFTW_OMP: [/usr/lib/x86_64-linux-gnu/libfftw3f_omp.so]
STATUS OF LIBRARY: WAVELIB: [/home/ziaee/prog/install_files/fCWT/src/libwavelib/libwavelib.a]
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ziaee/prog/install_files/fCWT/build
$ make
$ sudo make install
[ 62%] Built target fCWT_example
[100%] Built target fCWT
Linking CXX shared library CMakeFiles/CMakeRelink.dir/libfCWT.so
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/include/fcwt.h
-- Installing: /usr/local/lib/libfCWT.so.1.0
-- Installing: /usr/local/lib/libfCWT.so
-- Installing: /usr/local/share/fcwt/cmake/fCWT-config.cmake
-- Installing: /usr/local/share/fcwt/cmake/fCWT-config-release.cmake

from fcwt.

fastlib avatar fastlib commented on August 15, 2024

Dear @Ziaeemehr, thank you for reaching out! Looking at your output, I notice that FFTW is not properly linked which causes the majority if not all errors. This should not be caused by the difference in gcc compiler. It could be caused by the fact I built FFTW's library on a Mac which cannot be used on Linux. I cannot test this as I only have the possibility to test on Mac OSX and Windows. It could be that FFTW must be built and configured for Linux system specifically. Can you check this? If this works and you built the static libraries, you can do a pull-request so we can fix this for all Linux users.

More info about FFTW and its library can be found at their wonderful documentation https://www.fftw.org/fftw3_doc/Installation-on-Unix.html#Installation-on-Unix

Btw, the same is happening with Wavelib. Fortunately, Wavelib is only being used for benchmark purposes.

Let me know if you have any questions!

from fcwt.

Ziaeemehr avatar Ziaeemehr commented on August 15, 2024

I tried it on both Macbook 2020 and Ubuntu 20.04, both have the same error,
I can also link fftw3 for compiling a C++ code, so g++ can find it using something like this:

g++ -std=c++11 -O2 my_code.cpp -o prog -lm -lfftw3

I installed fftw3 by brew in mac and sudo apt-get in Ubunto, but I think it does not make difference as long as the compiler (gcc or g++) can find it.

I am not sure in this case but these errors usually appear when I forget to add -lfftw3.

@maedoc could you please check.

from fcwt.

fastlib avatar fastlib commented on August 15, 2024

Alright, good to know the error is persistent across systems. I see you provided your own FFTW installation. I expect that's where things go. We link FFTW in the src/fftw folder via the CMake 'find_library()' function. This function is configured such that it searches in the src/fftw folder.

I imagine linking is going wrong when you provide FFTW yourself. You could try to configure the search path in cmakelists.txt at line 121, and line 129 for the OMP version to search for your HomeBrew FFTW version (I expect in the /usr/local/lib folder). Make sure you have both the default FFTW library built as well as a multi-threaded version (omp is fastest, but pthreads is also possible).

Let me know if this solves the linking problem.

from fcwt.

maedoc avatar maedoc commented on August 15, 2024

@Ziaeemehr try removing the fftw3f.a files in the fCWT repo, apt-get install -y libfftw3-single3 and check that after cmake it reports that the FFTW3 library found is in /usr/... not the fCWT folder.

from fcwt.

Ziaeemehr avatar Ziaeemehr commented on August 15, 2024

modifing the CMakelist as follows and remowing library files from src/fftw resolved the errors for fftw

find_library (
    FFTW
    NAMES fftw3f libfftw3f # what to look for
    # HINTS "${PROJECT_SOURCE_DIR}/src/fftw" # where to look
    # NO_DEFAULT_PATH # do not search system default paths
    REQUIRED
)
if(UNIX)
	find_library (
		FFTW_OMP
		NAMES fftw3f_omp libfftw3f_omp # what to look for
		# HINTS "${PROJECT_SOURCE_DIR}/src/fftw" # where to look
		# NO_DEFAULT_PATH # do not search system default paths
		REQUIRED
	)
Build type is Release
Building of shared library is enabled.
/home/ziaee/prog/install_files/fCWT
STATUS OF LIBRARY: FFTW: [/usr/lib/x86_64-linux-gnu/libfftw3f.so]
STATUS OF LIBRARY: FFTW_OMP: [/usr/lib/x86_64-linux-gnu/libfftw3f_omp.so]
STATUS OF LIBRARY: WAVELIB: [/home/ziaee/prog/install_files/fCWT/src/libwavelib/libwavelib.a]
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ziaee/prog/install_files/fCWT/build

but doing the same thing for wavelib did not work. cmake still suggests src/libwavelib/libwavelib.a, however, I need to provide a path for wavelib, probably something like this

from fcwt.

fastlib avatar fastlib commented on August 15, 2024

Good to hear that editing lines 121,122 and 129,130 in the CMakeLists file works for FFTW! I don't see how wavelib fails to link. Did you also installed wavelib using HomeBrew or via another method?

from fcwt.

Ziaeemehr avatar Ziaeemehr commented on August 15, 2024

on mac the package seem to be installed correctly:

(base) ➜  build git:(main)  make
[ 14%] Building CXX object CMakeFiles/fCWT.dir/src/fcwt.cpp.o
[ 28%] Linking CXX shared library libfCWT.dylib
[ 28%] Built target fCWT
[ 42%] Building CXX object CMakeFiles/fCWT_example.dir/src/fcwt.cpp.o
[ 57%] Building CXX object CMakeFiles/fCWT_example.dir/src/main.cpp.o
[ 71%] Building CXX object CMakeFiles/fCWT_example.dir/src/rwave.cpp.o
[ 85%] Building CXX object CMakeFiles/fCWT_example.dir/src/wavelib.cpp.o
[100%] Linking CXX executable fCWT_example
[100%] Built target fCWT_example
(base) ➜  build git:(main) ✗ sudo make install
Password:
sudo: a password is required
(base) ➜  build git:(main)  sudo make install
Password:
Consolidate compiler generated dependencies of target fCWT
[ 28%] Built target fCWT
Consolidate compiler generated dependencies of target fCWT_example
[100%] Built target fCWT_example
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/include/fcwt.h
-- Installing: /usr/local/lib/libfCWT.1.0.dylib
/usr/local/opt/llvm/bin/install_name_tool: error: unsupported load command (cmd=0x80000034)
-- Installing: /usr/local/lib/libfCWT.dylib
-- Installing: /usr/local/share/fcwt/cmake/fCWT-config.cmake
-- Installing: /usr/local/share/fcwt/cmake/fCWT-config-release.cmake

on Ubuntu:
I don't have other installations of wavelib, probably need to be built by adding it to the project.

from fcwt.

fastlib avatar fastlib commented on August 15, 2024

For Ubuntu, you have two options:

  1. Remove wavelib from the example and compile without wavelib as it is only used for benchmark purposes, or
  2. you could rebuild wavelib's static library on Ubuntu using their source-code https://github.com/rafat/wavelib

Let me know if you succeed!

from fcwt.

sitadrost avatar sitadrost commented on August 15, 2024

I seem to be running into the same problem on Ubuntu 20.04 (with gcc-10): upon my first attempt to build fCWT I got these "undefined reference" errors regarding FFTW, so I was delighted when I found this post.
Following the instructions on their website, I then installed FFTW, and edited lines 121, 122, 129 and 130 in CMakeLists.txt.
Unfortunately, CMake still can't find the required FFTW lib files, even when I add a hint pointing to /usr/lib/x86_64-linux-gnu
FFTW lib files in this folder:

libfftw3f_omp.so.3
libfftw3f_omp.so.3.5.8
libfftw3f.so.3
libfftw3f.so.3.5.8
libfftw3f_threads.so.3
libfftw3f_threads.so.3.5.8
libfftw3_omp.so.3
libfftw3_omp.so.3.5.8
libfftw3.so.3
libfftw3.so.3.5.8
libfftw3_threads.so.3
libfftw3_threads.so.3.5.8

Wrong version? Something else I'm doing wrong?
Thanks in advance!

EDIT: Right, what I think goes wrong is that CMake is looking for a bare .so linker file, so the easiest solution seems to create a soft link. However, this post here advises against that, and suggests to look at the fallback guesses instead. What do you think?

EDIT 2: Awesome, after installing libfftw3 through the Ubuntu package manager (apt-get install -y libfftw3-single3, as recommended by @maedoc), I succeeded in building fCWT!

from fcwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.