cortoproject / corto

A hierarchical object store for connecting realtime machine data with web applications, historians & more
https://www.corto.io
MIT License
87 stars 14 forks source link

Display build error when Rake cannot find environment variable #612

Closed hendrenja closed 6 years ago

hendrenja commented 7 years ago

Utilizing environment variables to build and link against third party libraries simplify devops efforts. Example:

"LIBPATH": [
     "#{ENV['OSPL_HOME']}/lib"
],
"include" : [
    "$(CORTO_INCLUDE)",
    "#{ENV['OSPL_HOME']}/include/dcps/C++/CCPP",
    "#{ENV['OSPL_HOME']}/include/dcps/C++/isocpp2",
    "#{ENV['OSPL_HOME']}/include/dcps/C++/isocpp2/dds",
    "#{ENV['OSPL_HOME']}/include/dcps/C++/isocpp2/org",
    "#{ENV['OSPL_HOME']}/include/dcps/C++/SACPP"
]

The environment variables must be defined in the scope of the rake process. During the installation process, the build system invokes processes under sudo, which very likely does not have the target environment variables defined. An expected linker command specifying -L#{ENV['OSPL_HOME']}/lib will become -L/lib (which will not include the target libraries). It would be very useful if the Corto build system would warn of undefined environment variables.

NOTE: A potential workaround to specify environment variables to "keep" when running as sudo is explained @ https://stackoverflow.com/questions/8633461/how-to-keep-environment-variables-when-using-sudo. Add the following to /etc/sudoers:

Defaults  env_keep += "OSPL_HOME"
hendrenja commented 7 years ago

@SanderMertens Can you assign this issue to me?

SanderMertens commented 6 years ago

As the buildsystem is going to be migrated to bake and this is a rake/ruby specific problem, this issue will no longer be relevant.