diff --git a/src/shared/libosmocore/src/Makefile.am b/src/shared/libosmocore/src/Makefile.am
index 64310e0..e3c5f4b 100644
--- a/src/shared/libosmocore/src/Makefile.am
+++ b/src/shared/libosmocore/src/Makefile.am
@@ -17,7 +17,7 @@ libosmocore_la_SOURCES = timer.c select.c signal.c msgb.c rxlev_stat.c \
 
 if ENABLE_PLUGIN
 libosmocore_la_SOURCES += plugin.c
-libosmocore_la_LDFLAGS = -ldl
+libosmocore_la_LDFLAGS =
 endif
 
 if ENABLE_TALLOC
diff --git a/src/shared/libosmocore/src/gsm_utils.c b/src/shared/libosmocore/src/gsm_utils.c
index 31e3cd6..f55f411 100644
--- a/src/shared/libosmocore/src/gsm_utils.c
+++ b/src/shared/libosmocore/src/gsm_utils.c
@@ -355,6 +355,10 @@ void generate_backtrace()
 
 	free(strings);
 }
+#else
+void generate_backtrace()
+{
+}
 #endif
 
 enum gsm_band gsm_arfcn2band(uint16_t arfcn)
diff --git a/src/shared/libosmocore/src/msgfile.c b/src/shared/libosmocore/src/msgfile.c
index 68f0581..80c254c 100644
--- a/src/shared/libosmocore/src/msgfile.c
+++ b/src/shared/libosmocore/src/msgfile.c
@@ -28,6 +28,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <stdio.h>
 #include <string.h>
 
 static struct msg_entry *alloc_entry(struct msg_entries *entries,
@@ -111,7 +112,13 @@ struct msg_entries *msg_entry_parse(void *ctx, const char *filename)
 
 	n = 2342;
 	line = NULL;
+#if 0
         while (getline(&line, &n, file) != -1) {
+#else
+	while( (line = malloc(n + 1)) != NULL
+			&& fgets(line, n, file) != NULL) {
+		n = strlen(line);
+#endif
 		handle_line(entries, line);
 		free(line);
 		line = NULL;
diff --git a/src/shared/libosmocore/src/talloc.c b/src/shared/libosmocore/src/talloc.c
index 98c2ee0..84c013d 100644
--- a/src/shared/libosmocore/src/talloc.c
+++ b/src/shared/libosmocore/src/talloc.c
@@ -105,7 +105,7 @@
 #endif
 #endif
 
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__NetBSD__)
 /* taken from http://insanecoding.blogspot.com/2007/03/methods-for-safe-string-handling.html */
 size_t strnlen(const char *s, size_t n)
 {
diff --git a/src/target/firmware/include/stdint.h b/src/target/firmware/include/stdint.h
index 627403f..4cb82ce 100644
--- a/src/target/firmware/include/stdint.h
+++ b/src/target/firmware/include/stdint.h
@@ -17,6 +17,7 @@
 
 #if __GNUC__ > 3
 #include_next <stdint.h>
+#define __int8_t_defined
 #endif
 
 #ifndef __int8_t_defined
