Repository navigation
Build failures on OS X #379
Copy link
Copy link
Open
Description
Hello, I'm trying to compile the example but it is failing. I decided to build the library itself to see what's happening there, and that passed except make install (which is optional) fails.
My toolchain:
- CMake version 3.9.4
- OS X 10.9.5
- clang / Apple LLVM version 6.0 (clang-600.0.57)
Here is what actually happens during the builds:
$ pwd
(...)/stepcode
$ mkdir build; cd build
$ cmake .. -DSC_BUILD_SCHEMAS=ALL
(... successful-looking messages except for some warnings:)
CMake Deprecation Warning at CMakeLists.txt:58 (CMAKE_POLICY):
The OLD behavior for policy CMP0026 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
(...)
-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
base
express
libexppp
sdai_IFC4
sdai_ISO15926
sdai_ap203
sdai_ap203e2
sdai_ap209
sdai_ap210e2
sdai_ap210e3
sdai_ap214e3
sdai_ap219
sdai_ap227
sdai_ap235
sdai_ap238
sdai_ap239
sdai_ap240
sdai_ap242
sdai_ifc2x3
sdai_pdm
stepcore
stepdai
stepeditor
steplazyfile
steputils
This warning is for project developers. Use -Wno-dev to suppress it.
-- Generating done
-- Build files have been written to: (...)/stepcode/build
$ make
(... just some benign warnings about style)
$ make install
(... "up-to-date" or "installing")
-- Installing: (...)/stepcode/../sc-install/bin/schema_scanner
CMake Error at schemas/sdai_ISO15926/cmake_install.cmake:31 (file):
file INSTALL cannot find
"(...)/stepcode/build/schemas/sdai_ISO15926/entity/SdaiComposition_of_individual.h".
Call Stack (most recent call first):
data/cmake_install.cmake:36 (include)
cmake_install.cmake:43 (include)
make: *** [install] Error 1
And when trying to build the example:
$ pwd
(...)/stepcode/example/ap203min
$ mkdir build; cd build
$ cmake .. -DSTEPCODE_ROOT_DIR=../../..
(... successful except for the same two CMake warnings)
-- Generating done
-- Build files have been written to: (...)/stepcode/example/ap203min/build
$ make
(... more style warnings but successful-looking compilation until:)
Scanning dependencies of target express
[ 5%] Building C object sc/src/express/CMakeFiles/express.dir/symbol.c.o
[ 6%] Building C object sc/src/express/CMakeFiles/express.dir/type.c.o
[ 6%] Building C object sc/src/express/CMakeFiles/express.dir/variable.c.o
[ 7%] Building C object sc/src/express/CMakeFiles/express.dir/expr.c.o
[ 7%] Building C object sc/src/express/CMakeFiles/express.dir/entity.c.o
[ 7%] Building C object sc/src/express/CMakeFiles/express.dir/caseitem.c.o
[ 8%] Building C object sc/src/express/CMakeFiles/express.dir/stmt.c.o
[ 8%] Building C object sc/src/express/CMakeFiles/express.dir/alg.c.o
[ 10%] Building C object sc/src/express/CMakeFiles/express.dir/scope.c.o
[ 10%] Building C object sc/src/express/CMakeFiles/express.dir/schema.c.o
[ 11%] Building C object sc/src/express/CMakeFiles/express.dir/resolve.c.o
[ 11%] Building C object sc/src/express/CMakeFiles/express.dir/lexact.c.o
[ 12%] Building C object sc/src/express/CMakeFiles/express.dir/linklist.c.o
[ 12%] Building C object sc/src/express/CMakeFiles/express.dir/error.c.o
[ 13%] Building C object sc/src/express/CMakeFiles/express.dir/dict.c.o
[ 13%] Building C object sc/src/express/CMakeFiles/express.dir/hash.c.o
[ 13%] Building C object sc/src/express/CMakeFiles/express.dir/memory.c.o
[ 15%] Building C object sc/src/express/CMakeFiles/express.dir/object.c.o
[ 15%] Building C object sc/src/express/CMakeFiles/express.dir/express.c.o
[ 16%] Building CXX object sc/src/express/CMakeFiles/express.dir/ordered_attrs.cc.o
[ 16%] Building C object sc/src/express/CMakeFiles/express.dir/info.c.o
/Stuff/Schewl/UNI2/UROP/printer-sim/2018-08-30-ir/stepcode/src/express/info.c:8:12: fatal error: 'sc_version_string.h' file not found
# include "sc_version_string.h"
^
1 error generated.
make[2]: *** [sc/src/express/CMakeFiles/express.dir/info.c.o] Error 1
make[1]: *** [sc/src/express/CMakeFiles/express.dir/all] Error 2
make: *** [all] Error 2
Is there a problem with the path? I can see the sc_version_string.h file in the build directory of the library itself. Is the library supposed to be installed fully before the example can build?
Metadata
Metadata
Assignees
Labels
No labels
Activity
AureaNoire commentedon Sep 6, 2018
Tried building the example on a Linux machine, same problem, same file.
AureaNoire commentedon Sep 6, 2018
Ok, I found out the problem. Building the example makes it build
stepcodeas well, and this is in thebuild/scdirectory. Thebuild/scdirectory does include thesc_version_string.cmakescript which is supposed to createsc_version_string.h. Trying to run it directly withcmake -P sc_version_string.cmakefails, however:And indeed
SC_VERSION.txtis only in the root directory ofstepcode(and so is the.gitdirectory which it looks for first). Copying thesc_version_string.hfile generated by building the library itself intobuild/sc/includesolves the issue and the example builds fine, but this is just a workaround.So perhaps make sure the version string can be generated properly, and add the example build into Travis-CI? As for the
make installfailure, I'm not sure what is causing this, but it is also not covered by the CI.cshorler commentedon Sep 7, 2018
it sounds as if the generate step of the cmake process is not firing correctly. Did you see the schema_scanner being built by a sub-process of cmake?
I usually configure with cmake-gui, I'll try with command line tools on Linux and report back
AureaNoire commentedon Sep 7, 2018
Yes,
schema_scannerdid get built, I can see this in thecmakeoutput:Another somewhat relevant issue – when I set the schema (for the project I am using
stepcodefor) toap210e3, the linking step failed. Thebuild/CMakeFiles/project.dir/link.txtwas:I had to manually change it to:
I.e.
-lsdai_ap210e3_n8232_mim_lfwasn't found, so I replaced it withsc/schemas/sdai_ap210e3/libsdai_ap210e3.2.0.0.dylib. This seems like an OS X issue since it should (I assume) reference the dylib as it does in all the other referenced libraries. But it is weird that this doesn't happen with theap203schema.cshorler commentedon Sep 7, 2018
Best to focus on one thing at a time
The version header should be generated by cmake on Linux - I've just done it (for Git, now checking the last release)
Are you using a release or Git master?
AureaNoire commentedon Sep 7, 2018
Sure, I could open another issue for the latter problem if you want.
I am using the Git version.
cshorler commentedon Sep 7, 2018
what version of CMake do you have on Linux?
AureaNoire commentedon Sep 7, 2018
I posted my Linux toolchain above:
(OS X is my primary workspace though.)
cshorler commentedon Sep 7, 2018
okay, sorry missed that
My CMake is 3.10.2 - so quite a lot different, perhaps the problem lies there.
Is your Linux a standard distro?
cshorler commentedon Sep 7, 2018
sorry - just saw that too!
AureaNoire commentedon Sep 7, 2018
Well, it reports as a regular Ubuntu via
lsb_release -a, but it is running on university machines, so I cannot easily upgrade the toolchain on it. I am currently upgrading CMake on my OS X (it will be 3.12.1) so I'll let you know if it works with the newer version.cshorler commentedon Sep 7, 2018
okay - and I'll try to reproduce in a VM with Ubuntu image.
AureaNoire commentedon Sep 7, 2018
Ok, updated to CMake 3.12.1. The same error still:
cshorler commentedon Sep 7, 2018
Ubuntu 16 LTS with updates (same CMake version as you). It seems to configure and build - if you look at the attached log, are you doing anything different when you build?
The first thing I'd like to solve why the config header is not generated when you build.
ubuntu16-build.log
cshorler commentedon Sep 7, 2018
can you clear the build directory and start a fresh, if this doesn't solve it run build with VERBOSE=1
AureaNoire commentedon Sep 8, 2018
Sorry for the late response. On Ubuntu, I completely removed
stepcodeand did a fresh build, and my output for the same commands is pretty much identical. But it is not building the library that fails, it is building the example project that fails.cshorler commentedon Sep 8, 2018
okay, understood - I've now reproduced it for the example.
The rule to create the version string is only partially working, hence the missing header.
To workaround
$ make version_string
$ make
Also, the default flags for the compiler miss nullptr build-in type - workaround this by configuring with CXX_FLAGS include -std=c++11 (on Linux) - during the cmake step.
Looks like there's some work to do before the next release on this topic.
cshorler commentedon Sep 9, 2018
Is the initial compile problem (missing config header) also resolved on Mac by this?
Also:
in comment
#379 (comment)
you mention a linker error - that you had to amend the command line to correct. It looks like you've replaced the linker library switch by a file path. What was the original error? I'd guess you're missing a directory search switch (-L?)
in your first post there are a number of RPATH issues - probably something is missing for MacOS that needs to be implemented to fix those.
AureaNoire commentedon Sep 10, 2018
Ok, with:
The example project builds fine.
As for the linker error when using
ap210e3, if I do not changelink.txt, this is what the result is:I don't think the
RPATHwarning is relevant, because even during the example project build (which succeeds and usesap203), it warns aboutRPATHwhen runningcmake:cshorler commentedon Sep 10, 2018
the RPATH warning is not related, but it's also probably not implemented as it should be hence my comment.
For the linker, I'd guess we're missing a -L/path/to/lib switch to the linker. Can you try make VERBOSE=1 and see if it prints the linker command line?
AureaNoire commentedon Sep 11, 2018
I posted the link command already, since the linker invocation is the same as the contents of the generated
link.txtfile, but here it is again frommake VERBOSE=1:cshorler commentedon Sep 12, 2018
The cmake project file for the example uses a regular expression to build the library name for the link using the express glob match as input. Whilst this works for AP203 (due to the simple file name), the AP210e3 library name does not match the exp file name - therefore it fails.
That's not a bug as it stands - the example as-is works, although I suppose it could be enhanced to always use the correct library name.
AureaNoire commentedon Sep 13, 2018
Ah yes, I actually had a workaround which consisted of changing the
SCHEMA_LINK_NAMEvariable in the CMake file.So I suppose this issue is now just the fact that
make version_stringshould either run automatically or should be documented when building a project with STEPcode as a dependency.cshorler commentedon Sep 13, 2018
there is probably a bug in the CMakeLists / modules when generating the version string - I'll investigate this
For the library link error - I do agree it could be more generic, perhaps there's an easy fix - I'll take a look.
teamblubee commentedon Nov 19, 2018
I ran into this issue as well, it's failing to build I was able to build the package by manually invoking these commands.
I am using cmake 3.12.1
I did notice that the files in cmake/ folder uses depreciated syntax.
For instance
SC_CXX_schema_macros.cmake
This will not get executed unless you add a dependency to the exported artifact.
That means that even after I manually run the build steps; the ap242 libs and includes are not properly installed.
I can help debug this to get the build files working as expected.
cshorler commentedon Nov 23, 2018
Agreed, I noticed there is a lot of deprecated content in the cmake files!
If you look in develop branch, you'll see I removed some of the compatibility switches and increased the required cmake version. I also rewrote the extensions for detecting Lemon & RE2C. I think further cmake changes are probably necessary.
Currently I'm studying if it's possible (or worthwhile) to add a developer "check" target to cmake / make for static code analysis - I'm playing with smatch and the results are quite useful to avoid introducing errors when making changes. However, perhaps this is only useful for me as a safety net.
The high level of customisation / wrapping of cmake functions makes me question why we've so much machinery around cmake usage - surely it should be simpler.
teamblubee commentedon Nov 24, 2018
Older versions of CMAKE did require this much machinery to generate projects but the newer versions have improved things a lot.
Like you, trying to understand the entire project will take some time and doing a major code refactoring will require fully understanding what the essential data transformations.
a little rant;
Looking at stepfile format and iges before it; I can see why manufacturing is such a mess, with overly expensive machines that needs experts to program their interfaces.
There's an inherent disconnect between the model formats that's being exchanged and the machines that's suppose to turn those into finished pieces.
This is a much bigger problem than I initially anticipated.