Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

problem with libXm link errors on Intel Mac running Monterey OS (12.7.1)

69 views
Skip to first unread message

William Fawley

unread,
Jan 8, 2024, 1:44:11 PM1/8/24
to dislin-users
Over the past 20 years I have used DISLIN as an alternative, Fortran-compatible with NCAR graphics (the latter is no longer supported by NCAR and seems perhaps impossible to make on "Silicon" architecture Macs.)

Recently I have begun using DISLIN again and had no problem on an older Mac running Mojave OS. However, when I attempt to link on a 2018 vintage Mac running Monterey OS I have run into link problems (using the Intel ifort compiler, as was true on my Mojave OS Mac too).  Following the standard Mac OS instructions for DISLIN, I downloaded the OpenMotif libraries and put them in my Applications folder.

If I try to do a "standard" link with the dynamic libXm (Case 1 below),  there is a link error ( ld: malformed universal file: slice content is not mach-o or a static library file '/          Applications/OpenMotif21/lib/libXm.dylib'      ).  Most likely this is due to Monterey OS trying to deal with "universal" architures including Silicon OS and the Open Motif libraries were made many years previously before Silicon Macs were available.

If I try to link with a static libXm.a (Case 2), the linking appears to be successful but then when I try to run the resulting executable, I get an unresolved symbol error. ( dyld[17124]: symbol not found in flat namespace (_XtStrings) ).

Has anyone else seen issues like this and (ideally) overcome them?

Thank you (and deep thanks to Helmut Michels for making DISLIN available to the general community!)

Wm. Fawley,  SLAC Natl. Accelerator Lab

Case 1:  normal link with dynamic library libXm:

macmini-2018[567]>make xplotginh-DIS                                                                            
ifort -mkl=sequential -g   -Wl,-stack_size,0x4000000 -pie -diag-disable=406,8290,8291           -traceback -o xplotginh-DIS gplth_mod.o gplth_main.o  gplth_core.o  gplth_input.o  g          plth_spec.o gplth_pwr.o   gplth_par.o   gplth_ffld.o   gplth_util.o gplth_output.o  g          plth_HDF5_output.o   gplth_new.o  /Users/bill/PROG/GRF2K/OBJ-DEBUG/fawlib2K_mod.o               /Users/bill/PROG/GRF2K/OBJ-DEBUG/fawlib2k.o /Users/bill/PROG/GRF2K/OBJ-DEBUG/grf_uti          l2K.o       /Users/bill/PROG/GRF2K/OBJ-DEBUG/grf_devel2K.o /Users/bill/PROG/GRF2K/OBJ          -DEBUG/make_blueorange.o  ../GRF90/OBJ-DEBUG/faw_util90.o   ../GRF90/OBJ-DEBUG/fft.o           ../GRF90/OBJ-DEBUG/sdds_util90.o   ../GRF90/OBJ-DEBUG/cray_equiv90.o \                        
                           ../GRF90/OBJ-DEBUG/hdf5_util.o   -L/opt/HDF5/lib -lhdf5_fo          rtran  -lhdf5 -L/opt/intel/mkl/lib  -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -l          z    -L /opt/MacOS_SDK/usr/lib  -L/opt/DISLIN  -ldislin  -L/Applications/OpenMotif21/          lib  -lXm  -lz                                                                                
ipo: warning #11012: unable to find -l%s in %s                                                
ipo: warning #11012: unable to find -l%s in %s                                                
ipo: warning #11012: unable to find -l%s in %s                                                
ipo: warning #11012: unable to find -l%s in %s                                                
ipo: warning #11012: unable to find -l%s in %s                                                
ld: malformed universal file: slice content is not mach-o or a static library file '/        Applications/OpenMotif21/lib/libXm.dylib'                                                      
make: *** [xplotginh-DIS] Error 1    

My OpenMotif directory under lib is as follows (note I made the soft link 
( libXm.dylib -> libXm.3.1.dylib. )  :

ls -l /Applications/OpenMotif21/lib          
total 38512
drwxr-xr-x@  5 bill  admin      160 Oct 24  2015 X11
drwxr-xr-x@  3 bill  admin       96 Oct 24  2015 app-defaults
drwxr-xr-x@ 28 bill  admin      896 Oct 24  2015 bindings
-rwxr-xr-x@  1 bill  admin   398328 Oct 24  2015 libMrm.3.1.dylib
lrwxr-xr-x   1 bill  admin       16 Oct 24  2015 libMrm.3.dylib -> libMrm.3.1.dylib
-rwxr-xr-x@  1 bill  admin   582028 Oct 24  2015 libMrm.a
-rwxr-xr-x@  1 bill  admin  1160888 Oct 24  2015 libUil.3.1.dylib
lrwxr-xr-x   1 bill  admin       16 Oct 24  2015 libUil.3.dylib -> libUil.3.1.dylib
-rwxr-xr-x@  1 bill  admin  1523044 Oct 24  2015 libUil.a
-rwxr-xr-x@  1 bill  admin   110844 Oct 24  2015 libWsm.a
-rwxr-xr-x@  1 bill  admin  6423972 Oct 24  2015 libXm.3.1.dylib
lrwxr-xr-x   1 bill  admin       15 Oct 24  2015 libXm.3.dylib -> libXm.3.1.dylib
-rwxr-xr-x@  1 bill  admin  9107772 Oct 24  2015 libXm.a
lrwxr-xr-x   1 root  admin       15 Jan  5 14:25 libXm.dylib -> libXm.3.1.dylib
-rwxr-xr-x@  1 bill  admin   392196 Oct 24  2015 libwml.a

Case 2: Linking with static library libXm.a succeeds but then execution cannot find symbol _XtStrings. :

macmini-2018[576]>make xplotginh-DIS                                                          
ifort -mkl=sequential -g   -Wl,-stack_size,0x4000000 -pie -diag-disable=406,8290,8291           -traceback -o xplotginh-DIS gplth_mod.o gplth_main.o  gplth_core.o  gplth_input.o  g          plth_spec.o gplth_pwr.o   gplth_par.o   gplth_ffld.o   gplth_util.o gplth_output.o  g          plth_HDF5_output.o   gplth_new.o  /Users/bill/PROG/GRF2K/OBJ-DEBUG/fawlib2K_mod.o               /Users/bill/PROG/GRF2K/OBJ-DEBUG/fawlib2k.o /Users/bill/PROG/GRF2K/OBJ-DEBUG/grf_uti          l2K.o       /Users/bill/PROG/GRF2K/OBJ-DEBUG/grf_devel2K.o /Users/bill/PROG/GRF2K/OBJ          -DEBUG/make_blueorange.o  ../GRF90/OBJ-DEBUG/faw_util90.o   ../GRF90/OBJ-DEBUG/fft.o           ../GRF90/OBJ-DEBUG/sdds_util90.o   ../GRF90/OBJ-DEBUG/cray_equiv90.o \                        
                           ../GRF90/OBJ-DEBUG/hdf5_util.o     -L /opt/MacOS_SDK/usr/l          ib     -L/opt/DISLIN  -ldislin  /Applications/OpenMotif21/lib/libXm.a   -L/opt/HDF5/l          ib -lhdf5_fortran  -lhdf5 -L/opt/intel/mkl/lib  -lmkl_intel_lp64 -lmkl_intel_thread -          lmkl_core -lz                                                                                  
ipo: warning #11012: unable to find -l%s in %s                                                
ipo: warning #11012: unable to find -l%s in %s                                                
ipo: warning #11012: unable to find -l%s in %s                                                
ipo: warning #11012: unable to find -l%s in %s                                                
macmini-2018[577]>xplotginh-DIS -h | head                                                      
dyld[17124]: symbol not found in flat namespace (_XtStrings)

William Fawley

unread,
Jan 8, 2024, 5:15:39 PM1/8/24
to dislin-users
I think I solved the issue, at least in the case of using the dynamic-loaded library.  In the /Applications/OpenMotif21/lib directory, with the "lipo" tool  I extracted the x86_64 architecture and put it into a new file named libXm-x86_64.dylib  .  Then I relinked against this particular dynamic library.  No link errors and the executable now appears to run fine.  Specifically,

lipo libXm.3.1.dylib -extract x86_64  -output libXm-x86_64.dylib

Presumably, the lipo tool creates the proper mach-o format that Monterey OS apparently demands.  It is not overly surprising that the older Mojave OS was not as fussy as I have found a number of issues in Monterey (such as requiring  -L /opt/MacOS_SDK/usr/lib. on link lines to get the correct system routines ).

This scheme does not appear to work when I try to use the static libXm library, even when reduced to the x86_64 architecture only via lipo.  I still get errors when running the executable:

dyld[25029]: symbol not found in flat namespace (_XtStrings)
Abort trap: 6

As they say, your mileage may vary...

Helmut Michels

unread,
Jan 9, 2024, 5:30:05 AM1/9/24
to dislin-users
Hi William,

good to hear that you have found a workaround for your problem. If you link with the static OpenMotif library, you have to
link with some additional libraries I think. The command 'otool -L libXm.3.dylib' shows you the dynamic libraries
which are used automatically by libXm. The function XtStrings is included in the libXt library, so that you need at least the
options '-lXt' and '-lX11' for linking with the libXt and libX11 libraries.  

Best regards,

Helmut 
Reply all
Reply to author
Forward
0 new messages