Opened 3 years ago

Closed 3 years ago

#62867 closed defect (fixed)

ncarg: sh: -Wno-error=implicit-function-declaration: command not found

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: haspatch Cc: Dave-Allured (Dave Allured)
Port: ncarg

Description

https://build.macports.org/builders/ports-11_arm64-builder/builds/20191/steps/install-port/logs/stdio

DEBUG: system -W /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_science_ncarg/ncarg/work/ncl-6.6.2/config: CC=/opt/local/bin/h5cc  CFLAGS=-Os -Wno-error=implicit-function-declaration -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk  make -f Makefile.ini;  ./ymake -config `pwd`
sh: -Wno-error=implicit-function-declaration: command not found
/dev/tty: Device not configured.

So there are two problems:

First, when you pass CFLAGS to ymake you need to enclose them in quotation marks:

  • Portfile

    old new  
    169169    # run ymake
    170170    system -W ${worksrcpath}/config \
    171171        "CC=${configure.cc} \
    172         CFLAGS=${configure.cflags} \
     172        CFLAGS=\"${configure.cflags}\" \
    173173        make -f Makefile.ini; \
    174174        ./ymake -config `pwd`"

Second, -Wno-error=implicit-function-declaration needs to be removed because masking implicit function declaration errors will most likely just result in a build on Apple Silicon systems that does not work correctly:

  • Portfile

    old new  
    106106    }
    107107}
    108108
    109 configure.cflags-append     -Wno-error=implicit-function-declaration
    110109if {${configure.sdkroot} ne ""} {
    111110    configure.cflags-append     -isysroot ${configure.sdkroot}
    112111    configure.fflags-append     -isysroot ${configure.sdkroot}

After removing this flag, the build should fail with Xcode 12 and later with some implicit declaration of function errors as originally reported in #61275. They will need to be fixed properly, by declaring functions before calling them, e.g. by including the appropriate headers. You don't need to do it yourself; you can report the problem to the developers and have them do it. If they won't do it and you don't want to, then using -Wno-error=implicit-function-declaration is acceptable for Intel systems but you should then remove arm64 from supported_archs.

Change History (4)

comment:1 Changed 3 years ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:2 in reply to:  description Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

I originally filed this ticket thinking sh: -Wno-error=implicit-function-declaration: command not found was the cause of the build failure I was seeing, but I see now that it's not. I filed a new ticket about the actual cause of the build failure (#64710).

On my Intel system, although I get:

DEBUG: system -W /opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2/config: CC=/opt/local/bin/h5cc  CFLAGS=-Os -Wno-error=implicit-function-declaration -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  make -f Makefile.ini;  ./ymake -config `pwd`
sh: -Wno-error=implicit-function-declaration: command not found
/opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2/config/ymake-filter: Command not found.

the build then continues and finishes.

I wondered whether make -f Makefile.ini and ./ymake -config `pwd` not having run properly means that ncarg was built improperly or in any way differently. But I think that's not the case. It looks to me like make -f Makefile.ini compiles config/ymake-filter, and config/ymake uses config/ymake-filter to create config/makefile. So currently, with the Portfile quoting problem, config/makefile doesn't get created properly when the portfile tries to run ymake, but I see in the log that it does get run automatically by the build system later.

I ran two builds, one with the current portfile code and one with my revised code, and the relevant diff between the logs is:

  • .log

    old new  
    751751:debug:configure euid/egid changed to: 0/0
    752752:debug:configure setting attributes on /opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2/config/Darwin_Intel
    753753:debug:configure euid/egid changed to: 501/528
    754 :debug:configure system -W /opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2/config: CC=/opt/local/bin/h5cc  CFLAGS=-Os -Wno-error=implicit-function-declaration -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  make -f Makefile.ini;  ./ymake -config `pwd`
    755 :info:configure sh: -Wno-error=implicit-function-declaration: command not found
    756 :info:configure /opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2/config/ymake-filter: Command not found.
     754:debug:configure system -W /opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2/config: CC=/opt/local/bin/h5cc  CFLAGS=-Os\ -Wno-error=implicit-function-declaration\ -isysroot\ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  make -f Makefile.ini;  ./ymake -config `pwd`
     755:info:configure /opt/local/bin/h5cc -O   -c -o ymake-filter.o ymake-filter.c
     756:info:configure /opt/local/bin/h5cc -O -o ymake-filter ymake-filter.o
    757757:debug:configure Executing org.macports.configure (ncarg)
    758758:debug:configure system -W /opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2: ./Configure -v << EOF
    759759:debug:configure
     
    782782:debug:configure
    783783:debug:configure EOF
    784784:info:configure Building top-level Makefile to determine System defaults
    785 :info:configure Making ymake from Makefile.ini in ./config first
    786 :info:configure cc -O   -c -o ymake-filter.o ymake-filter.c
    787 :info:configure cc -O -o ymake-filter ymake-filter.o
    788 :info:configure Continuing in: /opt/local/var/macports/build/.../ncarg/work/ncl-6.6.2
    789785:info:configure Makefile built, checking defaults...
    790786:info:configure .....................................................................
    791787:info:configure *** Configuration Procedure for NCL and NCAR Graphics V6.6.2 ***

So here is the patch I propose:

(The ; between make -f Makefile.ini and ./ymake -config `pwd` should be changed to && so that failure of the first command will cause an error rather than allowing the second command to run.)

  • science/ncarg/Portfile

    a b pre-configure { 
    169169    # run ymake
    170170    system -W ${worksrcpath}/config \
    171171        "CC=${configure.cc} \
    172         CFLAGS=${configure.cflags} \
    173         make -f Makefile.ini; \
     172        CFLAGS=[shellescape ${configure.cflags}] \
     173        make -f Makefile.ini && \
    174174        ./ymake -config `pwd`"
    175175
    176176    # copy triangle.[ch]

According to http://ngwww.ucar.edu "NCAR Graphics is no longer supported" so I guess we won't be getting any help from them to resolve the implicit declaration of functions. Since the port already cannot build on arm64 for other reasons (#64710), continuing to suppress the implicit declaration of function errors is acceptable.

comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

comment:4 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In 0a751434acc4da64fc609ddd9d8579958d895f25/macports-ports (master):

ncarg: Escape cflags when building ymake-filter

Also change ; to && so that failure to build ymake-filter causes the
whole build to fail rather than continuing.

Closes: #62867

Note: See TracTickets for help on using tickets.