$build/binlib/cfg from MiKTeX Tools links against not-yet-installed...
MiKTeX source code moved to GitHub
Brought to you by:
csc
When comping MiKTeX Tools 2.9-2016-05-18 on OS X the binary $build/binlib/cfg links against the following:
> otool -L /path/to/miktex/work/build/binlib/cfg
/path/to/miktex/work/build/binlib/cfg:
/opt/local/lib/libMiKTeX209-core.1.dylib (compatibility version 1.0.0, current version 2.9.0)
/opt/local/lib/libMiKTeX209-md5.1.dylib (compatibility version 1.0.0, current version 2.9.0)
/opt/local/lib/libMiKTeX209-trace.1.dylib (compatibility version 1.0.0, current version 2.9.0)
/opt/local/lib/libMiKTeX209-util.1.dylib (compatibility version 1.0.0, current version 2.9.0)
/opt/local/lib/libpopt.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
where I used $build or /path/to/miktex/work/build as the synonym for directory where CMake is being run.
The problem is that while building MiKTeX, the libraries /opt/local/lib/libMiKTeX209-<whatever>.dylib do not yet exist and thus the binary $build/binlib/cfg is not functional until MiKTeX gets installed. The strategy of CMake files should be slightly modified if the bootstrapped binary was supposed to do something during the build already.
Here's the error that's thrown in some context:
[ 11%] Built target cfg
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Admin/Defaults/CMakeFiles/gen-defaults.dir/build.make Admin/Defaults/CMakeFiles/gen-defaults.dir/depend
cd /path/to/miktex/work/build && /opt/local/bin/cmake -E cmake_depends "Unix Makefiles" /path/to/miktex/work/miktex-2.9-2016-05-18 /path/to/miktex/work/miktex-2.9-2016-05-18/Admin/Defaults /path/to/miktex/work/build /path/to/miktex/work/build/Admin/Defaults /path/to/miktex/work/build/Admin/Defaults/CMakeFiles/gen-defaults.dir/DependInfo.cmake
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Admin/Defaults/CMakeFiles/gen-defaults.dir/build.make Admin/Defaults/CMakeFiles/gen-defaults.dir/build
[ 11%] Generating ../../include/miktex/mf.defaults.h
cd /path/to/miktex/work/build/include/miktex && /path/to/miktex/work/build/binlib/cfg --print-classes /path/to/miktex/work/build/Admin/Defaults/mf.defaults > mf.defaults.h
dyld: Library not loaded: /opt/local/lib/libMiKTeX209-core.1.dylib
Referenced from: /path/to/miktex/work/build/binlib/cfg
Reason: image not found
/bin/sh: line 1: 62601 Trace/BPT trap: 5 /path/to/miktex/work/build/binlib/cfg --print-classes /path/to/miktex/work/build/Admin/Defaults/mf.defaults > mf.defaults.h
make[2]: *** [include/miktex/mf.defaults.h] Error 133
make[2]: *** Deleting file `include/miktex/mf.defaults.h'
make[1]: *** [Admin/Defaults/CMakeFiles/gen-defaults.dir/all] Error 2
make: *** [all] Error 2
The same problem exists with
miktex-tangle,initctangle,ctangle,findtexmf.I was pointed to https://cmake.org/Wiki/CMake_RPATH_handling to perhaps get some ideas for fixing this.
Last edit: Mojca Miklavec 2016-05-20
There is one additional problem. The following two libraries end up in
$prefix/binrather than$prefix/lib:An additional anomaly is that they lack the usual "1.dylib" or "2.9.dylib" in the name, so they need a special treatment. This should be fixed.
Intermediate report.
The build seems to work if I add
to onfigure options. Or at least
cfgruns correctly. I wasn't able to finish the build due to other issues, so I cannot say for sure yet whether this is a proper set of options to be used. Once I get the complete build working, I can test further.