Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation errors compiling process on MacOS #261

Closed
newhoggy opened this issue Sep 15, 2022 · 4 comments · Fixed by #279
Closed

Deprecation errors compiling process on MacOS #261

newhoggy opened this issue Sep 15, 2022 · 4 comments · Fixed by #279

Comments

@newhoggy
Copy link

$ autoreconf -i
$ cabal build all
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - process-1.6.15.0 (lib:process) (first run)
Configuring process-1.6.15.0...
configure: WARNING: unrecognized options: --with-compiler
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for vfork.h... no
checking for pid_t... yes
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for signal.h... yes
checking for sys/wait.h... yes
checking for fcntl.h... yes
checking for setitimer... yes
checking for sysconf... yes
checking for execvpe... no
checking for spawn.h... yes
checking for posix_spawnp... yes
checking for posix_spawn_file_actions_addchdir... no
checking for /usr/bin/gcc options needed to detect all undeclared functions... none needed
checking whether POSIX_SPAWN_SETSID is declared... yes
checking whether POSIX_SPAWN_SETSID_NP is declared... no
checking whether POSIX_SPAWN_SETPGROUP is declared... yes
checking whether posix_spawn reports errors sensibly... yes
checking value of SIG_DFL... 0
checking value of SIG_IGN... 1
configure: creating ./config.status
config.status: creating include/HsProcessConfig.h
configure: WARNING: unrecognized options: --with-compiler
Preprocessing library for process-1.6.15.0..
Building library for process-1.6.15.0..
[1 of 5] Compiling System.Process.Common ( System/Process/Common.hs, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process/Common.o, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process/Common.dyn_o )
[2 of 5] Compiling System.Process.Posix ( System/Process/Posix.hs, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process/Posix.o, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process/Posix.dyn_o )
[3 of 5] Compiling System.Process.Internals ( System/Process/Internals.hs, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process/Internals.o, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process/Internals.dyn_o )
[4 of 5] Compiling System.Process   ( System/Process.hs, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process.o, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Process.dyn_o )
[5 of 5] Compiling System.Cmd       ( System/Cmd.hs, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Cmd.o, /Users/jky/wrk/iohk/process/dist-newstyle/build/aarch64-osx/ghc-8.10.7/process-1.6.15.0/build/System/Cmd.dyn_o )

cbits/posix/fork_exec.c:148:15: error:
     warning: 'vfork' is deprecated: Use posix_spawn or fork [-Wdeprecated-declarations]
        int pid = myfork();
                  ^
    |
148 |     int pid = myfork();
    |               ^

cbits/posix/fork_exec.c:32:16: error:
     note: expanded from macro 'myfork'
   |
32 | #define myfork vfork
   |                ^
#define myfork vfork
               ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:604:1: error:
     note: 'vfork' has been explicitly marked deprecated here
    |
604 | __deprecated_msg("Use posix_spawn or fork")
    | ^
__deprecated_msg("Use posix_spawn or fork")
^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:208:48: error:
     note: expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    |
208 |         #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
    |                                                ^
1 warning generated.

cbits/posix/fork_exec.c:148:15: error:
     warning: 'vfork' is deprecated: Use posix_spawn or fork [-Wdeprecated-declarations]
        int pid = myfork();
                  ^
    |
148 |     int pid = myfork();
    |               ^

cbits/posix/fork_exec.c:32:16: error:
     note: expanded from macro 'myfork'
   |
32 | #define myfork vfork
   |                ^
#define myfork vfork
               ^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:604:1: error:
     note: 'vfork' has been explicitly marked deprecated here
    |
604 | __deprecated_msg("Use posix_spawn or fork")
    | ^
__deprecated_msg("Use posix_spawn or fork")
^

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:208:48: error:
     note: expanded from macro '__deprecated_msg'
            #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                          ^
    |
208 |         #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
    |                                                ^
1 warning generated.
@newhoggy
Copy link
Author

This also happens on process-1.6.15.0.

@newhoggy
Copy link
Author

$ uname -a
Darwin MacBook-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64

@snoyberg
Copy link
Collaborator

Any thoughts on this @bgamari?

@bgamari
Copy link
Contributor

bgamari commented Mar 13, 2023

I suspect that the right approach here is to simply drop support for vfork. Afterall, it is quite a historical artifact, has quite ugly semantics,and consequently is indicated to be obsolete in POSIX.1-2001 and was removed entirely from POSIX.1-2008.

bgamari added a commit to bgamari/process that referenced this issue Mar 13, 2023
`vfork` is something of a relic, originally introduced as a (rather
unsafe) optimisation of `fork` in 3.0BSD, allowing the user to eliminate
the cost of cloning the parent process's address space (as early BSDs
would do) when `fork`ing with the intent of immediately `exec`ing.

However, its design has long been considered a mistake (being nigh
impossible to use safely in a multithreaded environment), its benefits
have largely vanished (since modern operating systems rely on virtual
memory to remap the parent's address space as copy-on-write instead of
copying), and nearly all platforms now consider it to be an alias of
`fork`.

Remove `process`'s support for `vfork`.

Fixes haskell#261.
bgamari added a commit that referenced this issue Mar 13, 2023
`vfork` is something of a relic, originally introduced as a (rather
unsafe) optimisation of `fork` in 3.0BSD, allowing the user to eliminate
the cost of cloning the parent process's address space (as early BSDs
would do) when `fork`ing with the intent of immediately `exec`ing.

However, its design has long been considered a mistake (being nigh
impossible to use safely in a multithreaded environment), its benefits
have largely vanished (since modern operating systems rely on virtual
memory to remap the parent's address space as copy-on-write instead of
copying), and nearly all platforms now consider it to be an alias of
`fork`.

Remove `process`'s support for `vfork`.

Fixes #261.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants