# Issue with using fftpack in MacOS 11.7

**URL:** <https://fortran-lang.discourse.group/t/issue-with-using-fftpack-in-macos-11-7/5179>\
**Category:** Help\
**Created:** [February 11, 2023, 4:21pm UTC](https://fortran-lang.discourse.group/t/issue-with-using-fftpack-in-macos-11-7/5179 "2023-02-11T16:21:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cval26](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@cval26](https://fortran-lang.discourse.group/u/cval26)\
**Post date:** [February 11, 2023, 4:21pm UTC](https://fortran-lang.discourse.group/t/issue-with-using-fftpack-in-macos-11-7/5179/1 "2023-02-11T16:21:44Z")

</div>

Hello,  
I’m trying to use the double precision `fftpack` routines in a simple program of mine. I have built the `fftpack` package with `fpm` with no problems, and the compiler seems to find the needed module and object files (I provide the right include path to the compiler to find those).

Even though the program compiles with no issue, when trying to execute my program I get the following error. The main program seems unable to find the functions I include from `fftpack`. I’m working on MacOS 11.7 (BigSur) using gfortran 12.2.

```plaintext
Undefined symbols for architecture x86_64:
  "_dfftf_", referenced from:
      _MAIN__ in cckgQ0YM.o
  "_dffti_", referenced from:
      _MAIN__ in cckgQ0YM.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

```

The program I’m trying to execute is the following.

```fortran
program main
	use, intrinsic :: iso_fortran_env, only: real64
	use fftpack, only: dffti, dfftf

	implicit none
	integer, parameter :: rk = real64
	integer, parameter :: n = 8
	integer, parameter :: nsave = 2*n+15
	real(rk), parameter :: pi = 4*atan(1.0_rk)

	integer :: i
	real(rk), dimension(n) :: xvec
	real(rk), dimension(nsave) :: wsave

	do i = 1, n
		xvec(i) = cos(2*pi*(i-1)/n)
	end do

	call dffti(n, wsave)
	call dfftf(n, xvec, wsave)
end program

```

---

<div class="post-metadata">

**Author:** ![zoziha](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/zoziha/32/582_2.png) [@zoziha](https://fortran-lang.discourse.group/u/zoziha)\
**Post date:** [February 11, 2023, 4:40pm UTC](https://fortran-lang.discourse.group/t/issue-with-using-fftpack-in-macos-11-7/5179/2 "2023-02-11T16:40:35Z")

</div>

I use fpm to pull fftpack and run your sample code, and everything is fine.  
I’m using Windows OS, and I think there is nothing wrong with your sample code, maybe there is something wrong with the link library you built, or is it the specificity of macOS?

---

<div class="post-metadata">

**Author:** ![cval26](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@cval26](https://fortran-lang.discourse.group/u/cval26)\
**Post date:** [February 11, 2023, 5:16pm UTC](https://fortran-lang.discourse.group/t/issue-with-using-fftpack-in-macos-11-7/5179/3 "2023-02-11T17:16:11Z")

</div>

Thank you for the prompt reply @zoziha. I solved the issue. It looks like I was providing the wrong library path to the compiler; the code runs properly now.

Thank you for trying out the sample program yourself though, it helped knowing that there was nothing wrong with it.
