AcademySoftwareFoundation / OpenShadingLanguage

Advanced shading language for production GI renderers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OSL build dies on Mac generating oslgram.cpp with brew bison

brlcad opened this issue · comments

Problem

Compiling OSL on Mac with dependencies installed via brew, make fails immediately when it runs bison on oslgram.y:

(base) morrison@agua .build % make VERBOSE=1
/usr/local/Cellar/cmake/3.21.2/bin/cmake -S/Users/morrison/src/OpenShadingLanguage -B/Users/morrison/src/OpenShadingLanguage/.build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.21.2/bin/cmake -E cmake_progress_start /Users/morrison/src/OpenShadingLanguage/.build/CMakeFiles /Users/morrison/src/OpenShadingLanguage/.build//CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/CopyFiles.dir/build.make CMakeFiles/CopyFiles.dir/depend
cd /Users/morrison/src/OpenShadingLanguage/.build && /usr/local/Cellar/cmake/3.21.2/bin/cmake -E cmake_depends "Unix Makefiles" /Users/morrison/src/OpenShadingLanguage /Users/morrison/src/OpenShadingLanguage /Users/morrison/src/OpenShadingLanguage/.build /Users/morrison/src/OpenShadingLanguage/.build /Users/morrison/src/OpenShadingLanguage/.build/CMakeFiles/CopyFiles.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/CopyFiles.dir/build.make CMakeFiles/CopyFiles.dir/build
make[2]: Nothing to be done for `CMakeFiles/CopyFiles.dir/build'.
[  0%] Built target CopyFiles
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f src/liboslcomp/CMakeFiles/oslcomp.dir/build.make src/liboslcomp/CMakeFiles/oslcomp.dir/depend
[  0%] Generating oslgram.cpp
cd /Users/morrison/src/OpenShadingLanguage/src/liboslcomp && /usr/local/opt/bison/bin/bison -dv -p osl -o /Users/morrison/src/OpenShadingLanguage/.build/src/liboslcomp/oslgram.cpp /Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y
/Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
/Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
/Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
make[2]: *** [src/liboslcomp/oslgram.cpp] Error 141
make[1]: *** [src/liboslcomp/CMakeFiles/oslcomp.dir/all] Error 2
make: *** [all] Error 2
(base) morrison@agua .build % bison --version
bison (GNU Bison) 3.8.1

Running in lldb, bison gets a signal 13 (sigpipe), though I couldn't figure out where/why. Obviously couldn't use system bison due to the parser's re-entrant syntax statements. Any ideas?

Versions

  • OSL branch/version: master/22105d298202b6908445d7d6c5a59e43b9936128
  • OS: Mac 11.5.2
  • C++ compiler: Apple clang version 12.0.5
  • LLVM version: 12.0.1
  • OIIO version: 2.2.18.0

Try doing the build with STOP_ON_WARNING=0 ?

Here's cmake output:

(base) morrison@agua .build % rm -rf CMakeCache.txt                                                                     
(base) morrison@agua .build % cmake -DCMAKE_INSTALL_PREFIX=/Users/morrison/Applications ..                              
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- The C compiler identification is AppleClang 12.0.5.12050022
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring OSL 1.12.3.0
-- CMake 3.21.2
-- CMake system           = Darwin-20.6.0
-- CMake system name      = Darwin
-- Project source dir     = /Users/morrison/src/OpenShadingLanguage
-- Project build dir      = /Users/morrison/src/OpenShadingLanguage/.build
-- Project install prefix = /Users/morrison/Applications
-- Configuration types    = 
-- Build type             = Release
-- Setting Namespace to: OSL_v1_12_3
-- CMAKE_CXX_COMPILER     = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- CMAKE_CXX_COMPILER_ID  = AppleClang
-- Building for C++14
-- Compiling with NO batched SIMD targets, USE_BATCHED is empty
-- clang-format found: /usr/local/opt/llvm/bin/clang-format
-- 
-- * Checking for dependencies...
-- *   - Missing a dependency 'Package'?
-- *     Try cmake -DPackage_ROOT=path or set environment var Package_ROOT=path
-- *     For many dependencies, we supply src/build-scripts/build_Package.bash
-- *   - To exclude an optional dependency (even if found),
-- *     -DUSE_Package=OFF or set environment var USE_Package=OFF 
-- 
-- CMAKE_PREFIX_PATH = /Users/morrison/src/OpenShadingLanguage/ext/dist
-- Found Boost 107600 
-- Found ZLIB 1.2.11 
-- Found OpenEXR 3.1.1 
-- Found OpenImageIO 2.2.18.0 
-- Found CONFIG for pugixml (>=1.11)
-- Found pugixml 1.11 
-- Found LLVM 12.0.1 
-- Could NOT find partio (missing: partio_DIR)
-- Found partio  
-- Found Python 3.9.7 
-- Found Qt5 5.9.7 
-- Found BISON 3.8.1 
-- Found FLEX 2.5.35 
-- Found pybind11 2.7.1 
-- All docdeep docs = /Users/morrison/src/OpenShadingLanguage/.build/src/doc/OSLQuery.md.html;/Users/morrison/src/OpenShadingLanguage/.build/src/doc/docdeep.md.html
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/morrison/src/OpenShadingLanguage/.build

STOP_ON_WARNING=0

Added -DSTOP_ON_WARNING=0 and it still fails. Bison appears to fail hard with a sigpipe for some reason (and more importantly does not generate oslgram.cpp).

Here's running bison directly in src/liboslcomp:

(base) morrison@agua liboslcomp % /usr/local/opt/bison/bin/bison -dv -p osl -o /Users/morrison/src/OpenShadingLanguage/.build/src/liboslcomp/oslgram.cpp /Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y
/Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
/Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
/Users/morrison/src/OpenShadingLanguage/src/liboslcomp/oslgram.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
(base) morrison@agua liboslcomp % echo $?
141

If I add -Wnone, I get no warnings, but still exits with 141 and no oslgram.cpp

Hmmm... I'm building on Mac also, with homebrew. Same version of bison, but not experiencing this problem.

Figured it out! Ran bison in --trace mode, and it parsed down through the .y no problem, but then it halted when it gets to running m4 internally to generate the output. Turns out there was an incompatible m4 in the system path that was causing the problem.

So, just a local issue. Sorry for the noise, but thank you for your help!

Aha, good to hear.