Linux build throwing steamworks errors


  • Culture

    // Copyright (c) 2015 Greenheart Games Pty. Ltd. All rights reserved.
    // Use of this source code is governed by the MIT license that can be
    // found in the LICENSE file.

    // The source code can be found in https://github.com/greenheartgames/greenworks
    var fs = require('fs');

    var greenworks;

    if (process.platform == 'darwin') {
    if (process.arch == 'x64')
    greenworks = require('./lib/greenworks-osx64');
    else if (process.arch == 'ia32')
    greenworks = require('./lib/greenworks-osx32');
    } else if (process.platform == 'win32') {
    if (process.arch == 'x64')
    greenworks = require('./lib/greenworks-win64');
    else if (process.arch == 'ia32')
    greenworks = require('./lib/greenworks-win32');
    } else if (process.platform == 'linux') {
    if (process.arch == 'x64')
    greenworks = require('./lib/greenworks-linux64');
    else if (process.arch == 'ia32')
    greenworks = require('./lib/greenworks-linux32');
    }

    function error_process(err, error_callback) {
    if (err && error_callback)
    error_callback(err);
    }

    // An utility function for publish related APIs.
    // It processes remains steps after saving files to Steam Cloud.
    function file_share_process(file_name, image_name, next_process_func,
    error_callback, progress_callback) {
    if (progress_callback)
    progress_callback("Completed on saving files on Steam Cloud.");
    greenworks.fileShare(file_name, function() {
    greenworks.fileShare(image_name, function() {
    next_process_func();
    }, function(err) { error_process(err, error_callback); });
    }, function(err) { error_process(err, error_callback); });
    }

    // Publishing user generated content(ugc) to Steam contains following steps:
    // 1. Save file and image to Steam Cloud.
    // 2. Share the file and image.
    // 3. publish the file to workshop.
    greenworks.ugcPublish = function(file_name, title, description, image_name,
    success_callback, error_callback, progress_callback) {
    var publish_file_process = function() {
    if (progress_callback)
    progress_callback("Completed on sharing files.");
    greenworks.publishWorkshopFile(file_name, image_name, title, description,
    function(publish_file_id) { success_callback(publish_file_id); },
    function(err) { error_process(err, error_callback); });
    };
    greenworks.saveFilesToCloud([file_name, image_name], function() {
    file_share_process(file_name, image_name, publish_file_process,
    error_callback, progress_callback);
    }, function(err) { error_process(err, error_callback); });
    }

    // Update publish ugc steps:
    // 1. Save new file and image to Steam Cloud.
    // 2. Share file and images.
    // 3. Update published file.
    greenworks.ugcPublishUpdate = function(published_file_id, file_name, title,
    description, image_name, success_callback, error_callback,
    progress_callback) {
    var update_published_file_process = function() {
    if (progress_callback)
    progress_callback("Completed on sharing files.");
    greenworks.updatePublishedWorkshopFile(published_file_id,
    file_name, image_name, title, description,
    function() { success_callback(); },
    function(err) { error_process(err, error_callback); });
    };

    greenworks.saveFilesToCloud([file_name, image_name], function() {
    file_share_process(file_name, image_name, update_published_file_process,
    error_callback, progress_callback);
    }, function(err) { error_process(err, error_callback); });
    }

    // Greenworks Utils APIs implmentation.
    greenworks.Utils.move = function(source_dir, target_dir, success_callback,
    error_callback) {
    fs.rename(source_dir, target_dir, function(err) {
    if (err) {
    if (error_callback) error_callback(err);
    return;
    }
    if (success_callback)
    success_callback();
    });
    }

    greenworks.init = function() {
    if (this.initAPI()) return;
    if (!this.isSteamRunning())
    throw new Error("Steam initialization failed. Steam is not running.");
    var appId;
    try {
    appId = fs.readFileSync('steam_appid.txt', 'utf8');
    } catch (e) {
    throw new Error("Steam initialization failed. Steam is running," +
    "but steam_appid.txt is missing. Expected to find it in: " +
    require('path').resolve('steam_appid.txt'));
    }
    if (!/^\d+ *\r?\n?$/.test(appId)) {
    throw new Error("Steam initialization failed. " +
    "steam_appid.txt appears to be invalid; " +
    "it should contain a numeric ID: " + appId);
    }
    throw new Error("Steam initialization failed, but Steam is running, " +
    "and steam_appid.txt is present and valid." +
    "Maybe that's not really YOUR app ID? " + appId.trim());
    }

    var EventEmitter = require('events').EventEmitter;
    greenworks.__proto__ = EventEmitter.prototype;
    EventEmitter.call(greenworks);

    greenworks._steam_events.on = function () {
    greenworks.emit.apply(greenworks, arguments);
    };

    process.versions['greenworks'] = greenworks._version;

    module.exports = greenworks;

  • Culture

    Replacing greenworks-linux64.node with the latest version from the greenworks github fixes that error, now I get:

    Error: STEAM_KEY environment variable not set

    I can't get a good copy/paste of the whole stacktrace, it won't stop scrolling and keeps breaking any attempts at selection.


  • Culture

    Found the log files, 

    Loading mods in 'mods'
    Connecting to storage
    Starting CLI server
    Connecting to local Steam client failed: Steam is not running
    Using Steam Web API authentication instead
    Error: STEAM_KEY environment variable is not set!
    at Object.startServer (/home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/backend/lib/game/server.js:89:19)
    at common.storage._connect.then.then (/home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/backend/lib/index.js:16:28)
    at _fulfilled (/home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/common/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/common/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/common/node_modules/q/q.js:796:13)
    at /home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/common/node_modules/q/q.js:604:44
    at runSingle (/home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/common/node_modules/q/q.js:137:13)
    at flush (/home/adam/.local/share/Steam/steamapps/common/Screeps/server/modules/common/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

  • Dev Team

    Screeps is using a custom version of greenworks, the prebuilt version from their github will not work. We're looking for a solution right now.

    As to STEAM_KEY error, check the Authentication section in README.html.


  • Culture

    Ok, after configuring .screepsrc, it works (With the replaced greenworks-linux64.node) 


  • Dev Team

    Yes, but keep in mind you won't be able to use native Steam authentication this way, i.e. an internet connection for the server and all clients is required.


  • Dev Team

    Alright, this has been fixed by greenworks developer. Please update your server and tell us if it works for you.



  • This seems to be resolved, but I have new errors now. I will start a new thread.



  • Just updated screeps in steam and I still receive the same error, but elsewhere.

    ELECTRON_ASAR.js:178
            return old.apply(this, arguments)
                       ^

    Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/kalvis/.local/share/Steam/steamapps/common/Screeps/server/modules/driver/native/build/Release/native.node)
        at Error (native)
        at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:178:20)
        at Object.Module._extensions..node (module.js:583:18)
        at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:178:20)
        at Module.load (module.js:473:32)
        at tryModuleLoad (module.js:432:12)
        at Function.Module._load (module.js:424:3)
        at Module.require (module.js:483:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/home/kalvis/.local/share/Steam/steamapps/common/Screeps/server/modules/driver/lib/index.js:876:18)
    ELECTRON_ASAR.js:178
            return old.apply(this, arguments)

  • Dev Team

    Please try this:

    sudo apt-get install libstdc++6


  • Seems that I already have it.

    libstdc++6 is already the newest version.


  • The problem is yours is a different version then was built against. 

    There are "ways" around this but the best for screeps is to rebuild 



  • I too already have libstdc++6 and am getting said error. How do I rebuild to fix it?



  • It's not that the library can't be found it's that a different version of the library is found. Probably because it was compiled with a different version of GCC. Remember that if you launch through steam you are launching in a static environment based on Ubuntu 12.04. If your launching via command line your using your (usually newer) version of libraries.

     

    Ahem G++



  • I'm right-clicking and launching through steam. Do I need to use the CLI?



  • Well, I tried the CLI, and got an entirely different error. Yay?

    Error: Module version mismatch. Expected 46, got 50.
        at Error (native)
        at Object.Module._extensions..node (module.js:435:18)
        at Module.load (module.js:344:32)
        at Function.Module._load (module.js:301:12)
        at Module.require (module.js:354:17)
        at require (internal/module.js:12:17)
        at Object.<anonymous> (/home/angle/.steam/steamapps/common/Screeps/server/modules/backend/greenworks/greenworks.js:22:18)
        at Module._compile (module.js:410:26)
        at Object.Module._extensions..js (module.js:417:10)
        at Module.load (module.js:344:32)



  • All i can tell you Angle is that I got these exact same errors too, and you need to rebuild the project. 

     

    http://screeps.com/forum/topic/523/Dedicated-Server

     

    That's what I did to get  up and running. ags131 helped alot