Opened 18 months ago

Last modified 18 months ago

#66346 new defect

meson @0.58.2 seems to have a flaw with "nm"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.0
Keywords: tiger ppc Cc: git@…, ctreleaven (Craig Treleaven)
Port: meson

Description

While building dav1d I see this report:

[52/67] /opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/meson --internal symbolextractor /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_multimedia_dav1d/dav1d/work/build src/libdav1d.6.dylib src/libdav1d.6.dylib src/libdav1d.6.dylib.p/libdav1d.6.dylib.symbols 
WARNING: ['nm'] does not work. Relinking will always happen on source changes.
error: nm: invalid argument --
Usage: nm [-agnopruUmxjlfAP[s segname sectname] [-] [-t format] [[-arch <arch_flag>] ...] [file ...]

I've seen similar messages before, when building other ports.

How can I determine which options were passed by meson to nm?

Attachments (2)

main.log (314.1 KB) - added by ballapete (Peter "Pete" Dyballa) 18 months ago.
Main.log from PPC Tiger/Mac OS X 10.4.11
patch-meson-BSD-nm.diff (611 bytes) - added by ballapete (Peter "Pete" Dyballa) 18 months ago.
Patch to convert Linux style arguments into BSD styles arguments for nm (/usr/bin/nm)

Download all attachments as: .zip

Change History (12)

Changed 18 months ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger/Mac OS X 10.4.11

comment:1 Changed 18 months ago by kencu (Ken)

might do best here to take this upstream, as MacPorts will have no clue about this internal meson business I think.

Although as it's just a warning, and it's on ancient Tiger, and as we are building packages, we don't care if it relinks on source changes anyway, as the source never changes for us. So not much of a problem.

How much interest you will get from upstream will be entertaining to see...

comment:2 Changed 18 months ago by ctreleaven (Craig Treleaven)

Cc: ctreleaven added

comment:3 Changed 18 months ago by ballapete (Peter "Pete" Dyballa)

There is an easy patch available:

--- mesonbuild/scripts/symbolextractor.py~	1970-01-01 01:00:00.000000000 +0100
+++ mesonbuild/scripts/symbolextractor.py	2022-12-01 18:32:05.000000000 +0100
@@ -146,8 +146,7 @@
             break
     result = [arr[match + 2], arr[match + 5]] # Libreoffice stores all 5 lines but the others seem irrelevant.
     # Get a list of all symbols exported
-    output = call_tool('nm', ['--extern-only', '--defined-only',
-                              '--format=posix', libfilename])
+    output = call_tool('nm', ['-a', '-U', '-P', libfilename])
     if not output:
         dummy_syms(outfilename)
         return

Comparing the output of llvm-nm as an example of a modern version of nm with that of old standard nm I get on the command line:

																    
									/opt/local/lib/libcharset.1.dylib(single module):	    
00000000 U ____mb_cur_max_l						         U ____mb_cur_max_l				    
00000b9c t ___initialize_Cplusplus					00000b9c t ___initialize_Cplusplus			    
00000b7c t __dyld_func_lookup						00000b7c t __dyld_func_lookup				    
00000000 T __mh_dylib_header						00000000 t __mh_dylib_header				    
00000da6 s _alias_table							00000da6 s _alias_table					    
00000ce4 T _libcharset_set_relocation_prefix				00000ce4 T _libcharset_set_relocation_prefix		    
00000bf8 T _locale_charset						00000bf8 T _locale_charset				    
00000000 U _nl_langinfo							         U _nl_langinfo					    
00000000 U _strcmp							         U _strcmp					    
00000000 U _uselocale							         U _uselocale					    
00000b74 t cfm_stub_binding_helper					00000b74 t cfm_stub_binding_helper			    
0000101c s dyld__mach_header						0000101c d dyld__mach_header				    
00000b44 t dyld_stub_binding_helper					00000b44 t dyld_stub_binding_helper			    

pete 256 /\ llvm-nm --defined-only /opt/local/lib/libcharset.1.dylib	pete 257 /\ nm -U /opt/local/lib/libcharset.1.dylib
															   
									/opt/local/lib/libcharset.1.dylib(single module):  
00000b9c t ___initialize_Cplusplus					00000b9c t ___initialize_Cplusplus		   
00000b7c t __dyld_func_lookup						00000b7c t __dyld_func_lookup			   
00000000 T __mh_dylib_header						00000000 t __mh_dylib_header			   
00000da6 s _alias_table							00000da6 s _alias_table				   
00000ce4 T _libcharset_set_relocation_prefix				00000ce4 T _libcharset_set_relocation_prefix	   
00000bf8 T _locale_charset						00000bf8 T _locale_charset			   
00000b74 t cfm_stub_binding_helper					00000b74 t cfm_stub_binding_helper		   
0000101c s dyld__mach_header						0000101c d dyld__mach_header			   
00000b44 t dyld_stub_binding_helper					00000b44 t dyld_stub_binding_helper		   

pete 258 /\ llvm-nm --format=posix /opt/local/lib/libcharset.1.dylib	pete 259 /\ nm -P /opt/local/lib/libcharset.1.dylib 
															    
									/opt/local/lib/libcharset.1.dylib(single module):   
____mb_cur_max_l U 00000000						____mb_cur_max_l U 0 0				    
___initialize_Cplusplus t 00000b9c					___initialize_Cplusplus t b9c 0			    
__dyld_func_lookup t 00000b7c						__dyld_func_lookup t b7c 0			    
__mh_dylib_header T 00000000						__mh_dylib_header t 0 0				    
_alias_table s 00000da6							_alias_table s da6 0				    
_libcharset_set_relocation_prefix T 00000ce4				_libcharset_set_relocation_prefix T ce4 0	    
_locale_charset T 00000bf8						_locale_charset T bf8 0				    
_nl_langinfo U 00000000							_nl_langinfo U 0 0				    
_strcmp U 00000000							_strcmp U 0 0					    
_uselocale U 00000000							_uselocale U 0 0				    
cfm_stub_binding_helper t 00000b74					cfm_stub_binding_helper t b74 0			    
dyld__mach_header s 0000101c						dyld__mach_header d 101c 0			    
dyld_stub_binding_helper t 00000b44					dyld_stub_binding_helper t b44 0		    

I had to insert two empty lines into the output of llvm-nm in order to get matching lines, because nm first outputs an empty line and then the path name of the shared library. Alas, to see before an after I tried to build libepoxy before patching meson – and ran into a problem:

Library dl found: YES
Checking for function "dlvsym" with dependency -ldl: NO 
Run-time dependency appleframeworks found: NO (tried framework)

test/meson.build:164:2: ERROR: Dependency "appleframeworks" not found, tried framework

Have to dig there a bit…

Last edited 18 months ago by ballapete (Peter "Pete" Dyballa) (previous) (diff)

comment:4 in reply to:  3 ; Changed 18 months ago by tomio-arisaka (Tomio Arisaka)

Replying to ballapete:

Library dl found: YES
Checking for function "dlvsym" with dependency -ldl: NO 
Run-time dependency appleframeworks found: NO (tried framework)

test/meson.build:164:2: ERROR: Dependency "appleframeworks" not found, tried framework

Have to dig there a bit…

see : https://github.com/macports/macports-ports/commit/9eaac52d45e052d7ed33e6c493fd47893107695b#comments

comment:5 in reply to:  4 ; Changed 18 months ago by ballapete (Peter "Pete" Dyballa)

Replying to tomio-arisaka:

Replying to ballapete:

see : https://github.com/macports/macports-ports/commit/9eaac52d45e052d7ed33e6c493fd47893107695b#comments

When will a correct Portfile be available? (I have no idea how to deal with the texts on that github pge.)

comment:6 in reply to:  5 Changed 18 months ago by tomio-arisaka (Tomio Arisaka)

I said "see : https://github.com/macports/macports-ports/commit/9eaac52d45e052d7ed33e6c493fd47893107695b#comments". It means that meson port has been broken since commit 9eaac52d45e052d7ed33e6c493fd47893107695b.

So we need the previous version of it.

For example, I got it as follows:

$ git clone https://github.com/macports/macports-ports.git
$ cd ./macports-ports/
$ git checkout 9eaac52d45e052d7ed33e6c493fd47893107695b
$ git log -n 2
commit 9eaac52d45e052d7ed33e6c493fd47893107695b (HEAD)
Author: barracuda156 <vital.had@gmail.com>
Date:   Fri May 13 07:53:47 2022 +0800

    meson: update to 0.62.1, add cross-files for ppc & ppc64

commit 2fd08a21f3008e8d8f6a2901bf74da1a4471cf05
Author: usersxx <97012123+usersxx@users.noreply.github.com>
Date:   Sun May 15 21:34:46 2022 +0530

    openjdkXX: fix builds
$ git checkout 2fd08a21f3008e8d8f6a2901bf74da1a4471cf05
$ find . -iname 'meson' -type d
./devel/meson

Then I think you can also get the previous version of the patch file.

comment:7 Changed 18 months ago by ballapete (Peter "Pete" Dyballa)

I found on macOS High Sierra, Version 10.13 or Darwin 17, and macOS Monterey, Version 12 or Darwin 21, that /usr/bin/nm understands both, BSD "-a" and Linux "--extern-only". Presumingly some more versions behave like them so that the following patch, in Attachments, can be used on Macs…

Changed 18 months ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-meson-BSD-nm.diff added

Patch to convert Linux style arguments into BSD styles arguments for nm (/usr/bin/nm)

comment:8 Changed 18 months ago by ballapete (Peter "Pete" Dyballa)

Nice surprise on PPC Leopard, Mac OS X 10.5.8:

leopard pete 223 /\ /usr/bin/nm -U /opt/local/lib/libcharset.dylib
/usr/bin/nm: invalid argument -U
Usage: /usr/bin/nm [-agnoprumxjlfAP[s segname sectname] [-] [-t format] [[-arch <arch_flag>] ...] [file ...]
leopard pete 224 /\ /usr/bin/nm --defined-only /opt/local/lib/libcharset.dylib
/usr/bin/nm: invalid argument --
Usage: /usr/bin/nm [-agnoprumxjlfAP[s segname sectname] [-] [-t format] [[-arch <arch_flag>] ...] [file ...]

The man page describes -U…

llvm-nm works correctly.

comment:9 Changed 18 months ago by kencu (Ken)

the older appleframeworks patchfile was restored here:

https://github.com/macports/macports-ports/commit/439761774952ff3cc28fb3ce336bc94f1de71bea

and pango builds again on tiger with this change.

comment:10 Changed 18 months ago by ballapete (Peter "Pete" Dyballa)

Somewhere else on Github I am "discussing" meson using faulty options: https://github.com/mesonbuild/meson/discussions/11131.

Note: See TracTickets for help on using tickets.