Troubleshooting ACC Code Issues
Introduction
On this page we will document some of the most common and most often issues seen while attempting to build and run ACC Code.
Note: We will constantly be adding to this page, when you see an issue when building or running ACC Code, please send email to the
ACC Code Librarian
*MacOS "PGPLOT /xw: cannot connect to X server" Error
Things to try when using PGPLOT on
MacOS and you see the error:
PGPLOT /xw: cannot connect to X server
- Install XQuartz -- provides core and development libraries for X11 X-Windows graphics support for tao and other packages that require graphical output.
- Set the environment variable:
export DISPLAY=:0
MacOS XCode 15.0 HDF5 Link Problem (2023/9/30)
[Reported by Chris Pierce (electronsandstuff on
GitHub)]
linker error in the HDF5 dependency when building on macOS with the latest release of XCode (15.0):
...
ld: unknown options: -commons
collect2: error: ld returned 1 exit status
gmake[1]: *** [Makefile:1534: H5detect] Error 1
gmake[1]: Leaving directory '/Users/chris/bmad-ecosystem/hdf5/debug/src'
gmake: *** [Makefile:729: install-recursive] Error 1
Error in building HDF5 VERSION HDF5-1.14.1-2 2023-07-12.
"This seems to be a known problem (ie
this forum post) and downgrading to version 14.3.1 fixes it"
Warnings when compiling cpp_bmad_interface
Some versions of gfortran will give warnings when compiling cpp_bmad_interface. EG:
[ 37%] Building CXX object CMakeFiles/cpp_bmad_interface.dir/code/cpp_equality.cpp.o
In file included from /opt/local/include/gcc12/c++/valarray:100,
from /Users/chrisonian/Code/bmad_svn/cpp_bmad_interface/include/converter_templates.h:4,
from /Users/chrisonian/Code/bmad_svn/cpp_bmad_interface/code/cpp_bmad_convert.cpp:12:
In static member function 'static void std::_Array_copy_ctor<_Tp, <anonymous> >::_S_do_it(const _Tp*, const _Tp*, _Tp*) [with _Tp = std::complex<double>; bool <anonymous> = false]',
inlined from 'void std::__valarray_copy_construct(const _Tp*, const _Tp*, _Tp*) [with _Tp = complex<double>]' at /opt/local/include/gcc12/c++/bits/valarray_array.h:163:57,
inlined from 'std::valarray<_Tp>::valarray(const std::valarray<_Tp>&) [with _Tp = std::complex<double>]' at /opt/local/include/gcc12/c++/valarray:648:37,
inlined from 'static void std::_Array_init_ctor<_Tp, <anonymous> >::_S_do_it(_Tp*, _Tp*, _Tp) [with _Tp = std::valarray<std::complex<double> >; bool <anonymous> = false]' at /opt/local/include/gcc12/c++/bits/valarray_array.h:108:4,
inlined from 'void std::__valarray_fill_construct(_Tp*, _Tp*, _Tp) [with _Tp = valarray<complex<double> >]' at /opt/local/include/gcc12/c++/bits/valarray_array.h:127:57,
inlined from 'void std::valarray<_Tp>::resize(std::size_t, _Tp) [with _Tp = std::valarray<std::complex<double> >]' at /opt/local/include/gcc12/c++/valarray:1044:37,
inlined from 'void operator<<(std::valarray<std::valarray<_Tp> >&, const std::valarray<std::valarray<_Tp> >&) [with T = std::valarray<std::complex<double> >]' at /Users/chrisonian/Code/bmad_svn/cpp_bmad_interface/include/converter_templates.h:53:76:
/opt/local/include/gcc12/c++/bits/valarray_array.h:143:11: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing 1 or more bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
143 | new(__o++) _Tp(*__b++);
| ^~~~~~~~~~~~~~~~~~~~~~
This is due to C++ std::valarray being not well developed. See
https://stackoverflow.com/questions/1602451/c-valarray-vs-vector.
Since these are only warnings, they can be ignored.
Xcode 14.0 Bug on Mac OS (2022-09-22)
Xcode 14.0 has a linker bug which causes compiling of hdf5 to fail with the message:
Making install in src
gmake[2]: Entering directory '/Users/dcs16/Bmad/bmad_dist/hdf5/production/c++/src'
CXXLD libhdf5_cpp.la
0 0x1050ac1a0 __assert_rtn + 140
1 0x104f33a8c mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
2 0x104f05d38 mach_o::relocatable::Parser<arm64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 148
3 0x104f6e4ac ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468
4 0x104f71360 ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56
5 0x186e1c1f4 _dispatch_client_callout2 + 20
6 0x186e2f954 _dispatch_apply_invoke + 224
7 0x186e1c1b4 _dispatch_client_callout + 20
8 0x186e2da04 _dispatch_root_queue_drain + 680
9 0x186e2e104 _dispatch_worker_thread2 + 164
10 0x186fdc324 _pthread_wqthread + 228
A linker snapshot was created at:
/tmp/libhdf5_cpp.103.dylib-master.o-2022-09-22-222813.ld-snapshot
ld: Assertion failed: (_file->_atomsArrayCount == computedAtomCount && "more atoms allocated than expected"), function parse, file macho_relocatable_file.cpp, line 2061.
collect2: error: ld returned 1 exit status
gmake[2]: *** [Makefile:909: libhdf5_cpp.la] Error 1
gmake[2]: Leaving directory '/Users/dcs16/Bmad/bmad_dist/hdf5/production/c++/src'
gmake[1]: *** [Makefile:805: install-recursive] Error 1
gmake[1]: Leaving directory '/Users/dcs16/Bmad/bmad_dist/hdf5/production/c++'
gmake: *** [Makefile:654: install-recursive] Error 1
Error in building HDF5 VERSION HDF5-1.10.4 2018-10-05.
The solution is to downgrade to Xcode 13. As of 2022/10/18, Xcode 14.1 beta 3 is reported to fix the problem.
FGSL Compile Failure
Symptom: Compiling GSL gives an error that looks like:
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) unsupported
checking for gcc option to enable C99 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
./configure: line 14338: PKG_PROG_PKG_CONFIG: command not found
./configure: line 14340: syntax error near unexpected token `gsl,'
./configure: line 14340: `PKG_CHECK_MODULES(gsl, gsl >= 2.5)'
Solution: Update
automake and
pkg_config. For example, for Ubuntu the pkg-config update command is
sudo apt-get install pkg-config
Symptom: Generally happens when compiling fgsl. The following output is seen
Makefile.am:11: error: Libtool library used but 'LIBTOOL' is undefined
...
./configure: line 4978: syntax error near unexpected token `2.1.0'
./configure: line 4978: `LT_PREREQ(2.1.0)'
The solution is to do the following (assuming the problem is building fgsl):
cd fgsl
libtoolize
mk # Test to see if solution works
cd ..
./util/dist_build_production # Continue with build.
Xcode 11 BUG ALERT (2020-5-6)
- Due to a bug in Xcode 11, building the Bmad Distribution on macOS 10.14 Mojave will fail - Please do not upgrade to Xcode 11 with macOS 10.14 Mojave.
Got "ld: library not found for -lSystem" error on Mac
This is is due to an incompatibility problem between Xcode and the Mac operating system. See:
https://stackoverflow.com/questions/58072318/cannot-link-any-c-program-with-gcc-on-mac-mojave
Got "WARNING - no compatible fortran compiler found" message
The symtom is when util/dist_prefs is run when Bmad is initialized, the following error is generated:
WARNING - no compatible fortran compiler found, unable to build the Bmad Distribution.
Please install GNU GCC/gfortran version 5.3, or later
or set your PATH to where a minimum GNU GCC/gfortran version of 5.3 is located.
First check that gcc is installed using the command
> gcc --version
If a valid gcc version is installed, check that gfortran is installed
> gfortran --version
If everything looks OK, contact a
Bmad maintainer.
PGPLOT's pgxwin_server Not Found
The symptom is that running a program (EG: Tao) that uses the PGPLOT plotting package results in the error:
PGPLOT /xw: Couldn't find program "pgxwin_server" in the directory named
PGPLOT /xw: in your PGPLOT_DIR environment variable, or in any directory
PGPLOT /xw: listed in your PATH environment variable.
The problem may be there was a problem with compiling PGPLOT. To diagnose, try recompiling PGPLOT. To do this, go to the PGPLOT directory and issue the commands
mk cleaner
mk
If you see an error that, for example, the headerfile called X11/intrinsic.h is missing, the solution is to install the header file and recompile PGPLOT.
All Programs Bomb
If all programs are bombing with a similar error message like:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x7fba69e9b2da in ???
#1 0x7fba69e9a503 in ???
#2 0x7fba694fef1f in ???
#3 0x7fffe95bc8f4 in ???
Segmentation fault (core dumped)
The problem could be that the
ulimit setup has not been done. Ulimit setup instructions for offsite running are at
here.
The way to diagnose this problem is to use the command:
ulimit -a
And comparing the actual limits with what should be
set.
Fatal Error Compiling lapack with Mac 10.14 (Mojave)
If you see the following error compiling lapack with Mac 10.14 (Mojave):
../include/lapacke.h:44:10: fatal error: stdlib.h: No such file or directory
#include <stdlib.h>
Try this:
See:
https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave
https://trac.macports.org/wiki/ProblemHotlist#reinstall-clt
Program is Slow
Running a
profile will show where in the code a program is taking the most time
Distribution compile time errors
When running the util/dist_build_production
or util/dist_build_debug
scripts, a failure mode occurs when one or more compile tools(automake, libtool, etc.) are missing and xraylib does not build. The script will continue and finally the build will terminate with an error like:
/bmad_dist/bmad/photon/xraylib_interface.f90:36.4: use xraylib, dummy => r_e 1 Fatal *Error: Can't open module file 'xraylib.mod'* for reading at (1): No such file or directory gmake[3]: *** [CMakeFiles/bmad.dir/photon/xraylib_interface.f90.o] Error 1 gmake[2]: *** [CMakeFiles/bmad.dir/photon/xraylib_interface.f90.o.provides] Error 2 gmake[2]: *** Waiting for unfinished jobs.... gmake[1]: *** [CMakeFiles/bmad.dir/all] Error 2 gmake: *** [all] Error 2
- Solution: cd to the xraylib directory and issue the command mk . The output after this command should show you what compile tools are missing. Then use the appropriate system commands to install them.
"Undefined Reference to" Link Errors:
An "undefined reference to " error can be generated if the compiler used for compiling and linking the program is different from the compiler used to build the libraries that the program needs to link to (the libraries linked to are listed in the LINK_LIBS statement in the cmake.XXX file). The error would look something like:
Linking C executable /home/dcs16/linux_lib/debug/bin/newin /usr/bin/cmake28 -E cmake_link_script CMakeFiles/newin-exe.dir/link.txt --verbose=Y gmake[2]: Entering directory `/nfs/acc/user/dcs16/linux_lib/test_peck/debug' gmake[2]: Nothing to be done for `CMakeFiles/newin.dir/build'. gmake[2]: Leaving directory `/nfs/acc/user/dcs16/linux_lib/test_peck/debug' /usr/bin/cmake28 -E cmake_progress_report /home/dcs16/linux_lib/test_peck/debug/CMakeFiles 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 /opt/rh/devtoolset-3/root/usr/bin/cc -g CMakeFiles/newin-exe.dir/code/newin.c.o -o /home/dcs16/linux_lib/debug/bin/newin -L/home/dcs16/linux_lib/test_peck/../debug/lib -L/nfs/acc/libs/Linux_x86_64_intel/devel/packages/debug/lib -L/nfs/acc/libs/Linux_x86_64_intel/devel/debug/lib -L/nfs/acc/libs/Linux_x86_64_intel/devel/packages/debug/lib/root -rdynamic -Wl,-Bstatic -lgenplt ../../debug/lib/libmpm_utils.a -lmpmnet ../../debug/lib/libcesr_utils.a ../../debug/lib/libsim_utils.a -lc_utils -Wl,-Bdynamic -lcurses -lMrm -lXm -lXt -lSM -lICE -lX11 -lXext -lreadline -ltermcap -lcurses -lpthread -lstdc++ -lactivemq-cpp -Wl,-Map=/home/dcs16/linux_lib/test_peck/../debug/map/newin.map -Wl,-rpath,/home/dcs16/linux_lib/test_peck/../debug/lib:/nfs/acc/libs/Linux_x86_64_intel/devel/packages/debug/lib:/nfs/acc/libs/Linux_x86_64_intel/devel/debug/lib:/nfs/acc/libs/Linux_x86_64_intel/devel/packages/debug/lib/root [ 97%] Built target newin /nfs/acc/libs/Linux_x86_64_intel/devel/debug/lib/libgenplt.a(gg_flush_ps.f90.o): In function `gg_flush_ps': /nfs/acc/libs/Linux_x86_64_intel/cesr_2015_0127_d/genplt/gg/gg_flush_ps.f90:7: *undefined reference to `for_write_seq_fmt'* /nfs/acc/libs/Linux_x86_64_intel/cesr_2015_0127_d/genplt/gg/gg_flush_ps.f90:7: *undefined reference to `for_write_seq_fmt_xmit'*
In this case, the compiler mismatch is diagnosed by realizing that the undefined references refer to modules are associated with the compiler. For example, looking at the above printout, and doing a Google search, shows that for_write_seq_fmt is part of the ifort compiler library.
- Solution: The mismatch can come about when linking modules compiled from code written in different languages. Add set(IMPLICIT_LINK_LIBS ) to the cmake PROJECT file and replace with the language used to build the libraries in the LINK_LIBS statement.
An "undefined reference to " error can be generated if the two
xraylib libraries:
xrlf03 and
xrl. are not in the correct order in the LINK_LIBS statement in the cmake.XXX file. The error would look something like:
Linking Fortran executable /home/dcs16/linux_lib/production/bin/spin1
/nfs/acc/libs/Linux_x86_64_intel/devel/packages/production/lib/libxrlf03.a(libxrlf03_la-xraylib_wrap.o): In function `xraylib_mp_compoundparser_':
xraylib_wrap.F90:(.text+0x2cd): undefined reference to `CompoundParser'
/nfs/acc/libs/Linux_x86_64_intel/devel/packages/production/lib/libxrlf03.a(libxrlf03_la-xraylib_wrap.o): In function `xraylib_mp_freecompounddata_':
xraylib_wrap.F90:(.text+0x636): undefined reference to `xrlFree'
xraylib_wrap.F90:(.text+0x667): undefined reference to `xrlFree'
- Solution: Reorder the libraries in the cmake.XXX file.
Problem Building XRAYLIB
Symptom error message:
configure.ac:45: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
configure: WARNING: unrecognized options: --disable-libtool-lock
configure: error: cannot find install-sh, install.sh, or shtool in build-aux "."/build-aux
- Solution: Upgrade automake. Version 1.14 is known to fail.
PLPLOT Compile Error on MAC
Symptom error message
ld: unexpected token: !tapi-tbd-v3 file '/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status
sudo port install ld64 +ld64_xcode
Getting Help
If you need to contact someone for help, please see the
Help and Mailing List Information wiki page.