Opened 8 years ago

Closed 2 years ago

#53152 closed defect (invalid)

scons does not honor $PATH

Reported by: jeremyhu (Jeremy Huddleston Sequoia) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: scons

Description

In the build phase, ar is resolving to /usr/bin/ar rather than ${prefix}/bin/ar as I'd expect because ${prefix}/bin seems to not be in $PATH any more.

Am I misremembering?

Was this change intentional?

--->  Building serf1
DEBUG: Executing org.macports.build (serf1)
DEBUG: Environment: 
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_www_serf1/serf1/work/.CC_PRINT_OPTIONS'
CPATH='/opt/local/include'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='10.6'
Executing:  cd "/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_www_serf1/serf1/work/serf-1.3.8" && /opt/local/bin/scons -j6 APR=/opt/local APU=/opt/local OPENSSL=/opt/local PREFIX=/opt/local CC=/opt/local/bin/clang-mp-3.9 CPPFLAGS="-I/opt/local/include" CFLAGS="-Os -arch x86_64 -arch i386" LINKFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386" CC="MACOSX_DEPLOYMENT_TARGET=10.6 /opt/local/bin/clang-mp-3.9" 
DEBUG: system:  cd "/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_www_serf1/serf1/work/serf-1.3.8" && /opt/local/bin/scons -j6 APR=/opt/local APU=/opt/local OPENSSL=/opt/local PREFIX=/opt/local CC=/opt/local/bin/clang-mp-3.9 CPPFLAGS="-I/opt/local/include" CFLAGS="-Os -arch x86_64 -arch i386" LINKFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386" CC="MACOSX_DEPLOYMENT_TARGET=10.6 /opt/local/bin/clang-mp-3.9" 
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
ar rc libserf-1.a context.o incoming.o outgoing.o ssltunnel.o buckets/aggregate_buckets.o buckets/allocator.o buckets/barrier_buckets.o buckets/buckets.o buckets/bwtp_buckets.o buckets/chunk_buckets.o buckets/dechunk_buckets.o buckets/deflate_buckets.o buckets/file_buckets.o buckets/headers_buckets.o buckets/iovec_buckets.o buckets/limit_buckets.o buckets/mmap_buckets.o buckets/request_buckets.o buckets/response_body_buckets.o buckets/response_buckets.o buckets/simple_buckets.o buckets/socket_buckets.o buckets/ssl_buckets.o auth/auth.o auth/auth_basic.o auth/auth_digest.o auth/auth_spnego.o auth/auth_spnego_gss.o auth/auth_spnego_sspi.o
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture context.o       1482632001  502   80    100644  16904     `
¾ºþÊ malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture context.o       1482632001  502   80    100644  16904     `
¾ºþÊ malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture buckets.o       1482632002  502   80    100644  17356     `
¾ºþÊ malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture buckets.o       1482632002  502   80    100644  17356     `
¾ºþÊ malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture dechunk_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture dechunk_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture deflate_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture deflate_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture headers_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture headers_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture response_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture response_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture ssl_buckets.o   1482632004  502   80    100644  62640     `
¾ºþÊ malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture ssl_buckets.o   1482632004  502   80    100644  62640     `
¾ºþÊ malformed object (unknown load command 2)
/usr/bin/ranlib: library member: libserf-1.a(context.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(dechunk_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(deflate_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(headers_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(response_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(ssl_buckets.o) is not an object file (not allowed in a library with multiple architectures)
ar: internal ranlib command failed
MACOSX_DEPLOYMENT_TARGET=10.6 /opt/local/bin/clang-mp-3.9 -o auth/auth_spnego_gss.os -c -Os -arch x86_64 -arch i386 -std=c89 -Wdeclaration-after-statement -Wmissing-prototypes -Wall -O2 -fPIC -I/opt/local/include -DNDEBUG -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -DDARWIN_10 -I. -I/opt/local/include/apr-1 -I/opt/local/include -I/opt/local/include auth/auth_spnego_gss.c
MACOSX_DEPLOYMENT_TARGET=10.6 /opt/local/bin/clang-mp-3.9 -o auth/auth_spnego_sspi.os -c -Os -arch x86_64 -arch i386 -std=c89 -Wdeclaration-after-statement -Wmissing-prototypes -Wall -O2 -fPIC -I/opt/local/include -DNDEBUG -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -DDARWIN_10 -I. -I/opt/local/include/apr-1 -I/opt/local/include -I/opt/local/include auth/auth_spnego_sspi.c
scons: *** [libserf-1.a] Error 1
Creating 'serf-1.pc'
scons: building terminated because of errors.
Command failed:  cd "/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_www_serf1/serf1/work/serf-1.3.8" && /opt/local/bin/scons -j6 APR=/opt/local APU=/opt/local OPENSSL=/opt/local PREFIX=/opt/local CC=/opt/local/bin/clang-mp-3.9 CPPFLAGS="-I/opt/local/include" CFLAGS="-Os -arch x86_64 -arch i386" LINKFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386" CC="MACOSX_DEPLOYMENT_TARGET=10.6 /opt/local/bin/clang-mp-3.9" 
Exit code: 2
Error: Failed to build serf1: command execution failed
DEBUG: Error code: CHILDSTATUS 9404 2
DEBUG: Backtrace: command execution failed
    while executing
"system {*}$notty {*}$nice $fullcmdstring"
    invoked from within
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"$procedure $targetname"
Error: See /opt/local/var/macports/logs/_Users_jeremy_src_macports_macports-ports_www_serf1/serf1/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port serf1 failed

Change History (6)

comment:1 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Component: baseports
Port: scons added

Looks like a bug in scons.

scons seems to not be honoring $PATH in the calling environment:

$ which ar
/opt/local/bin/ar

$ /opt/local/bin/scons -j6 APR=/opt/local APU=/opt/local OPENSSL=/opt/local PREFIX=/opt/local CC=/opt/local/bin/clang-mp-3.9 CPPFLAGS="-I/opt/local/include" CFLAGS="-Os -arch x86_64 -arch i386" LINKFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386" CC="MACOSX_DEPLOYMENT_TARGET=10.6 /opt/local/bin/clang-mp-3.9"
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
ar rc libserf-1.a context.o incoming.o outgoing.o ssltunnel.o buckets/aggregate_buckets.o buckets/allocator.o buckets/barrier_buckets.o buckets/buckets.o buckets/bwtp_buckets.o buckets/chunk_buckets.o buckets/dechunk_buckets.o buckets/deflate_buckets.o buckets/file_buckets.o buckets/headers_buckets.o buckets/iovec_buckets.o buckets/limit_buckets.o buckets/mmap_buckets.o buckets/request_buckets.o buckets/response_body_buckets.o buckets/response_buckets.o buckets/simple_buckets.o buckets/socket_buckets.o buckets/ssl_buckets.o auth/auth.o auth/auth_basic.o auth/auth_digest.o auth/auth_spnego.o auth/auth_spnego_gss.o auth/auth_spnego_sspi.o
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture context.o       1482632001  502   80    100644  16904     `
???? malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture context.o       1482632001  502   80    100644  16904     `
???? malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture buckets.o       1482632002  502   80    100644  17356     `
???? malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture buckets.o       1482632002  502   80    100644  17356     `
???? malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture dechunk_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture dechunk_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture deflate_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture deflate_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture headers_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture headers_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture response_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture response_buckets.o malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(x86_64) architecture ssl_buckets.o   1482632004  502   80    100644  62640     `
???? malformed object (unknown load command 2)
/usr/bin/ranlib: for object: libserf-1.a(i386) architecture ssl_buckets.o   1482632004  502   80    100644  62640     `
???? malformed object (unknown load command 2)
/usr/bin/ranlib: library member: libserf-1.a(context.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(dechunk_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(deflate_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(headers_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(response_buckets.o) is not an object file (not allowed in a library with multiple architectures)
/usr/bin/ranlib: library member: libserf-1.a(ssl_buckets.o) is not an object file (not allowed in a library with multiple architectures)
ar: internal ranlib command failed
scons: `libserf-1.dylib' is up to date.
scons: `serf-1.pc' is up to date.
scons: *** [libserf-1.a] Error 1
scons: building terminated because of errors.

comment:2 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Summary: ${prefix}/bin is not in PATH during buildscons does not honor $PATH

comment:3 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

http://scons.org/doc/1.2.0/HTML/scons-user/x1673.html

7.3.1. Propagating PATH From the External Environment


 You may want to propagate the external PATH to the execution environment for commands. You do this by initializing the PATH variable with the PATH value from the os.environ dictionary, which is Python's way of letting you get at the external environment:


        import os
        env = Environment(ENV = {'PATH' : os.environ['PATH']})
      

 Alternatively, you may find it easier to just propagate the entire external environment to the execution environment for commands. This is simpler to code than explicity selecting the PATH value:


        import os
        env = Environment(ENV = os.environ)
      

 Either of these will guarantee that SCons will be able to execute any command that you can execute from the command line. The drawback is that the build can behave differently if it's run by people with different PATH values in their environment--for example, if both the /bin and /usr/local/bin directories have different cc commands, then which one will be used to compile programs will depend on which directory is listed first in the user's PATH variable.

So... yet another completely braindead broken by design build system. It's up to each project to decide that it should honor the build environment?!?

comment:4 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

In c1f05c31/macports-ports:

serf1: Honor $PATH when building

See #53152

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@…>

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

Replying to jeremyhu:

So... yet another completely braindead broken by design build system. It's up to each project to decide that it should honor the build environment?!?

Pretty much. scons is awful.

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

Resolution: invalid
Status: newclosed

Closing as invalid since it's behaving as its developers intend, even if it seems inconvenient or wrong to us.

Note: See TracTickets for help on using tickets.