Build failing on Mac

Issue #181 resolved
Bradley Dice created an issue

Building freud on my Mac is failing unexpectedly, in code using getpid. This build process usually works fine for me, suggesting that a recent change has caused this error. The commit linked here (https://bitbucket.org/glotzer/freud/commits/5e1e702b8ae41b54a1e8edf5d82241beab6546da#chg-cpp/registration/brute_force.h) is the last place that the line with getpid was changed on line 447 of brute_force.h, but that isn't the cause of the problem since it existed previously, with different indentation.

The actual cause probably has to do with my choice of compiler and/or target. See the link here: https://bugzilla.mozilla.org/show_bug.cgi?id=909914

-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Found PythonInterp: /Users/bdice/anaconda3/envs/dice/bin/python3 (found version "3.6.4")
-- Found PythonLibs: /Users/bdice/anaconda3/envs/dice/lib/libpython3.6m.dylib
-- Found Cython: /Users/bdice/anaconda3/envs/dice/bin/cython
-- Found PythonLibs: /Users/bdice/anaconda3/envs/dice/lib/libpython3.6m.dylib (found version "3.6.4")
-- Found numpy: /Users/bdice/anaconda3/envs/dice/lib/python3.6/site-packages/numpy/core/include
-- Updating git submodules
-- Detected conda python, activating workaround
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bdice/code/freud/build
[30/41] Building CXX object cpp/CMakeFiles/_freud.dir/environment/MatchEnv.cc.o
FAILED: cpp/CMakeFiles/_freud.dir/environment/MatchEnv.cc.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -D_freud_EXPORTS -DNO_IMPORT_ARRAY -I/Users
/bdice/homebrew/include -I/Users/bdice/anaconda3/envs/dice/include/python3.6m -I/Users/bdice/anaconda3/envs/dice/lib/python3.6/site-pac
kages/numpy/core/include -I../extern -I../cpp -I../cpp/box -I../cpp/bond -I../cpp/util -I../cpp/locality -I../cpp/cluster -I../cpp/dens
ity -I../cpp/voronoi -I../cpp/kspace -I../cpp/order -I../cpp/environment -I../cpp/interface -I../cpp/pmft -I../cpp/parallel -I../cpp/re
gistration -Icpp -Wall -Wno-unknown-pragmas -Wno-deprecated-declarations -O3 -DNDEBUG -fPIC   -std=gnu++11 -MD -MT cpp/CMakeFiles/_freu
d.dir/environment/MatchEnv.cc.o -MF cpp/CMakeFiles/_freud.dir/environment/MatchEnv.cc.o.d -o cpp/CMakeFiles/_freud.dir/environment/Matc
hEnv.cc.o -c ../cpp/environment/MatchEnv.cc
In file included from ../cpp/environment/MatchEnv.cc:6:
In file included from ../cpp/environment/MatchEnv.h:21:
../cpp/registration/brute_force.h:447:48: error: use of undeclared identifier 'getpid'
                        seeds.push_back(size_t(getpid()));

Comments (7)

  1. Bradley Dice reporter
    • changed version to 0.9

    The current release of v0.8.2 in the maint branch works fine, so this is a newly-introduced regression.

  2. Bradley Dice reporter

    Using git bisect, I found that the error was introduced in commit 25097e1997ed08f3caab8bb520f5744512249d0b. It seems that removing Boost from the #includes caused this error. I did some research and found that getpid() is defined in <unistd.h> for POSIX-compliant systems. This may be included by Boost, or Boost may provide its own getpid(). Either way, I am filing a small PR to fix this issue.

  3. Log in to comment