From 128b2623cca8d66df77cfe0121be236959c1e2ac Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Thu, 19 Nov 2015 17:02:01 +0100
Subject: [PATCH] More small fixes for compilation on Linux

---
 xs/Build.PL                      | 4 +++-
 xs/src/libslic3r/GCodeSender.cpp | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xs/Build.PL b/xs/Build.PL
index 44066c28d..08bb259d1 100644
--- a/xs/Build.PL
+++ b/xs/Build.PL
@@ -52,7 +52,9 @@ $have_boost = 1
         LIBS    => join(' ', map "-L$_", @INC, @boost_libs),
     );
 
-if (!$have_boost) {
+if ($have_boost) {
+    push @LIBS, '-lboost_system', '-lboost_thread';
+} else {
     foreach my $path (@boost_libs) {
         my @files = glob "$path/libboost_system*";
         next if !@files;
diff --git a/xs/src/libslic3r/GCodeSender.cpp b/xs/src/libslic3r/GCodeSender.cpp
index 27a2d34c5..56b256a06 100644
--- a/xs/src/libslic3r/GCodeSender.cpp
+++ b/xs/src/libslic3r/GCodeSender.cpp
@@ -105,8 +105,8 @@ GCodeSender::set_baud_rate(unsigned int baud_rate)
         long closestSpeed = ss.baud_base / ss.custom_divisor;
         //cout << " Closest speed " << closestSpeed << endl;
         ss.reserved_char[0] = 0;
-        if (closestSpeed < baud * 98 / 100 || closestSpeed > baud_rate * 102 / 100) {
-            throw std::exception("Failed to set baud rate");
+        if (closestSpeed < baud_rate * 98 / 100 || closestSpeed > baud_rate * 102 / 100) {
+            printf("Failed to set baud rate\n");
         }
 
         ioctl(handle, TIOCSSERIAL, &ss);
@@ -316,7 +316,7 @@ GCodeSender::on_read(const boost::system::error_code& error,
                 }
                 this->send();
             } else {
-                printf("Cannot resend %lu (last was %lu)\n", toresend, this->sent);
+                printf("Cannot resend %zu (last was %zu)\n", toresend, this->sent);
             }
         } else if (boost::starts_with(line, "wait")) {
             // ignore