Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meep .tar.gz build fails without MPB #2485

Closed
PinkMushroom opened this issue Apr 25, 2023 · 5 comments · Fixed by #2486
Closed

meep .tar.gz build fails without MPB #2485

PinkMushroom opened this issue Apr 25, 2023 · 5 comments · Fixed by #2486
Labels

Comments

@PinkMushroom
Copy link

Linux mint 21.1 Vera

configure ran without issues once the dependendencies were installed.

make runs for a while and then starts producing a LOT of errors, I'm just providing the first few.

possibly a missing package that configure is not detecting ?

make[3]: Entering directory '/opt/meep-1.26.0/python'
  CXX      _meep_la-meep-python.lo
meep-python.cxx: In function 'PyObject* _wrap_eigenmode_data_mdata_set(PyObject*, PyObject*)':
meep-python.cxx:141689:3: error: 'maxwell_data' was not declared in this scope
141689 |   maxwell_data *arg2 = (maxwell_data *) 0 ;
       |   ^~~~~~~~~~~~
meep-python.cxx:141689:17: error: 'arg2' was not declared in this scope; did you mean 'arg1'?
141689 |   maxwell_data *arg2 = (maxwell_data *) 0 ;
       |                 ^~~~
       |                 arg1
meep-python.cxx:141689:39: error: expected primary-expression before ')' token
141689 |   maxwell_data *arg2 = (maxwell_data *) 0 ;
       |                                       ^

@stevengj
Copy link
Collaborator

stevengj commented Apr 25, 2023

Looks like SWIG is generating getters/setters for the mdata field the internal eigenmode_data struct, which will cause compilation to fail if you don't have MPB installed.

We haven't noticed this because we normally build Meep linked to MPB (so that we can use eigenmode sources and mode decomposition features), but it should be possible to build Meep without this (though you won't get those features).

There should be a way to prevent SWIG from generating getter/setter code for those internal fields using a SWIG %ignore directive.

(For now, a workaround is to install MPB. Alternatively you could re-generate the SWIG file on your system by configuring in maintainer mode and deleting python/meep-python.cxx.)

@stevengj stevengj added the bug label Apr 25, 2023
@stevengj stevengj changed the title build errors using meep-1.26.0.tar.gz meep .tar.gz build fails without MPB Apr 25, 2023
@PinkMushroom
Copy link
Author

I installed mpb

ii mpb 1.11.1-4 amd64 MIT Photonic-Bands
ii mpb-scm 1.11.1-4 all MIT Photonic-Bands initialisation files

and unfortunately still getting exactly the same error. I deleted the directory and started over, so there shouldn't be any leftovers causing trouble.

@stevengj
Copy link
Collaborator

Is there a missing -dev package that has the mpb.h files? Did the configure script say that it found MPB when it ran? (The config.h file should contain #define HAVE_MPB 1 if this is the case.)

(The next release of Meep should compile without MPB.)

@PinkMushroom
Copy link
Author

PinkMushroom commented Apr 28, 2023

Good grief, what a noob thing to forget. yes, i had forgotten to install the -dev package. however...


ii  mpb                                        1.11.1-4                                   amd64        MIT Photonic-Bands
ii  mpb-dev                                    1.11.1-4                                   amd64        MIT Photonic-Bands development files
ii  mpb-scm                                    1.11.1-4                                   all          MIT Photonic-Bands initialisation files

it's there now, but configure doesn't seem want to define HAVE_MPB, this is what shows up in config.h,

/* Define if you have libmpb */
/* #undef HAVE_MPB */

I edited the config.h manually and added

#define HAVE_MPB 1

then ran make again and now i get a different error

/usr/bin/ld: ../src/.libs/libmeep.so: undefined reference to `maxwell_compute_e_from_d'
/usr/bin/ld: ../src/.libs/libmeep.so: undefined reference to `evect_destroy_constraints'
/usr/bin/ld: ../src/.libs/libmeep.so: undefined reference to `destroy_evectmatrix'
...

which looks suspiciously like now it's not linking the mpb library.

So having been defeated i erased the directory and started again (again) and examined config.log where i found this:

configure:26852: checking for mpb.h
configure:26852: g++ -c -O3 -fstrict-aliasing -mtune=native  conftest.cpp >&5
configure:26852: $? = 0
configure:26852: result: yes
configure:28324: checking for maxwell_target_operator1 in -lmpb
configure:28354: g++ -o conftest -O3 -fstrict-aliasing -mtune=native   conftest.cpp -lmpb   -lopenblas -lm   -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. -lgfortran -lm -lquadmath >&5
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libmpb.a(libmaxwell_la-maxwell_op.o): in function `maxwell_compute_fft':
(.text+0xad): undefined reference to `fftw_execute_dft'
/usr/bin/ld: (.text+0x13f): undefined reference to `fftw_execute_dft'
/usr/bin/ld: (.text+0x1a1): undefined reference to `fftw_plan_many_dft'
/usr/bin/ld: (.text+0x1dc): undefined reference to `fftw_plan_many_dft'
/usr/bin/ld: (.text+0x225): undefined reference to `fftw_destroy_plan'
/usr/bin/ld: (.text+0x24d): undefined reference to `fftw_destroy_plan'
collect2: error: ld returned 1 exit status

huh.... i guess i'll install fftw (shouldn't the configure script have flagged that ?) and then I should be good, right ?! No. LOL.

/usr/bin/ld: (.text+0x13f): undefined reference to `fftw_execute_dft'
/usr/bin/ld: (.text+0x1a1): undefined reference to `fftw_plan_many_dft'
/usr/bin/ld: (.text+0x1dc): undefined reference to `fftw_plan_many_dft'
collect2: error: ld returned 1 exit status
configure:28354: $? = 1

So now i have fftw errors, but fewer of them. Do i have an fftw version problem ?

ii  fftw-dev                                   2.1.5-6                                    amd64        library for computing Fast Fourier Transforms
ii  fftw2                                      2.1.5-6                                    amd64        library for computing Fast Fourier Transforms
ii  libfftw3-double3:amd64                     3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - Double precision
ii  libfftw3-single3:amd64                     3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - Single precision

edit: yes, i have an fftw version problem. That's really annoying. You, of course, have to install "fftw3-dev" NOT "fftw-dev".

i  libfftw3-bin                               3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - Tools
ii  libfftw3-dev:amd64                         3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - development
ii  libfftw3-double3:amd64                     3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - Double precision
ii  libfftw3-long3:amd64                       3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - Long precision
ii  libfftw3-quad3:amd64                       3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - Quad precision
ii  libfftw3-single3:amd64                     3.3.8-2ubuntu8                             amd64        Library for computing Fast Fourier Transforms - Single precision

And SUCCESS !

I'm unclear on whether the configure scripts failure to flag fftw3 as missing is a bug or not. I would think that you would need it for "base" meep regardless of whether mpb was being included or not.

Thanks for your help !

p.s. don't forget to add /usr/local/lib to your LD_LIBRARY_PATH :-)

@stevengj
Copy link
Collaborator

I'm unclear on whether the configure scripts failure to flag fftw3 as missing is a bug or not. I would think that you would need it for "base" meep regardless of whether mpb was being included or not.

FFTW is not used directly in Meep.

Arguably it's a missing dependency for the mpb-dev package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants