wolfCLU (wolfssl command line utility) compile help

Is anyone interested in helping me getting this to compile? You can only compile it against master (requires wolfssl > 5.1).
I'm completely out of my depth for cross compiling and understanding how the tooling works. I've been scratching my head for a few nights now and i'm pretty sure my issue is that it is taking system includes as a priority over the toolchain. How i fix that? No idea.

This is what i've got so far, and any help appreciated. Makefile needs a lot of cleaning up this is just for getting it to compile.
Makefile

#
# Copyright (C) 2006-2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=wolfCLU
PKG_VERSION:=1
PKG_RELEASE:=$(AUTORELEASE)
PKG_REV:=6b97b2c752bd220196710bb94203d53170bc2b8d

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfCLU.git

PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz

PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/wolfCLU
  SECTION:=libs
  SUBMENU:=SSL
  CATEGORY:=Libraries
  TITLE:=wolfSSL Command Line Utility
  URL:=http://www.wolfssl.com/
  MENU:=1
  DEPENDS:=+libwolfssl
endef

define Package/wolfCLU/description
wolfSSL Command Line Utility (wolfCLU)
endef

TARGET_CPPFLAGS += \
	-D__gnuc_va_list=va_list -D_VA_LIST_DEFINED

define Package/wolfCLU/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/wolfssl $(1)/usr/bin/
endef

$(eval $(call BuildPackage,wolfCLU))

Patches/001-make-client-build.patch

--- a/wolfclu/client.h
+++ b/wolfclu/client.h
@@ -24,8 +24,49 @@
 #define WOLFSSL_CLIENT_H
 
 #define NO_MAIN_DRIVER
-typedef void* THREAD_RETURN;
-#define WOLFSSL_THREAD
+#ifdef SINGLE_THREADED
+    typedef unsigned int  THREAD_RETURN;
+    typedef void*         THREAD_TYPE;
+    #define WOLFSSL_THREAD
+#else
+    #if defined(_POSIX_THREADS) && !defined(__MINGW32__)
+        typedef void*         THREAD_RETURN;
+        typedef pthread_t     THREAD_TYPE;
+        #define WOLFSSL_THREAD
+        #define INFINITE (-1)
+        #define WAIT_OBJECT_0 0L
+    #elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_KEIL_TCP_NET) || defined(FREESCALE_MQX)
+        typedef unsigned int  THREAD_RETURN;
+        typedef int           THREAD_TYPE;
+        #define WOLFSSL_THREAD
+    #elif defined(WOLFSSL_TIRTOS)
+        typedef void          THREAD_RETURN;
+        typedef Task_Handle   THREAD_TYPE;
+        #ifdef HAVE_STACK_SIZE
+          #undef EXIT_TEST
+          #define EXIT_TEST(ret)
+        #endif
+        #define WOLFSSL_THREAD
+    #elif defined(WOLFSSL_ZEPHYR)
+        typedef void            THREAD_RETURN;
+        typedef struct k_thread THREAD_TYPE;
+        #ifdef HAVE_STACK_SIZE
+          #undef EXIT_TEST
+          #define EXIT_TEST(ret)
+        #endif
+        #define WOLFSSL_THREAD
+    #elif defined(NETOS)
+        typedef UINT        THREAD_RETURN;
+        typedef TX_THREAD   THREAD_TYPE;
+        #define WOLFSSL_THREAD
+        #define INFINITE TX_WAIT_FOREVER
+        #define WAIT_OBJECT_0 TX_NO_WAIT
+    #else
+        typedef unsigned int  THREAD_RETURN;
+        typedef intptr_t      THREAD_TYPE;
+        #define WOLFSSL_THREAD __stdcall
+    #endif
+#endif
 
 THREAD_RETURN WOLFSSL_THREAD client_test(void* args);
 

Modification to wolfssl Makefile

--- a/package/libs/wolfssl/Makefile
+++ b/package/libs/wolfssl/Makefile
@@ -79,7 +79,8 @@ CONFIGURE_ARGS += \
        --enable-altcertchains \
        --disable-crypttests \
        --disable-examples \
        --disable-jobserver \
+       --$(if $(CONFIG_PACKAGE_wolfCLU),enable,disable)-wolfclu \
        --$(if $(CONFIG_IPV6),enable,disable)-ipv6 \
        --$(if $(CONFIG_WOLFSSL_HAS_AES_CCM),enable,disable)-aesccm \
        --$(if $(CONFIG_WOLFSSL_HAS_CERTGEN),enable,disable)-certgen \

Current error i'm facing:

In file included from /usr/include/sys/select.h:30,
                 from /home/michael/comp/ipq806x-src/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.4.0_musl_eabi/include/fortify/sys/select.h:22,
                 from /usr/include/sys/time.h:32,
                 from /home/michael/comp/ipq806x-src/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include/wolfssl/wolfcrypt/wc_port.h:1404,
                 from /home/michael/comp/ipq806x-src/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include/wolfssl/wolfcrypt/types.h:35,
                 from /home/michael/comp/ipq806x-src/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include/wolfssl/wolfcrypt/logging.h:33,
                 from /home/michael/comp/ipq806x-src/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include/wolfssl/ssl.h:35,
                 from src/client/client.c:35:
/home/michael/comp/ipq806x-src/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include/wolfssl/test.h: In function 'tcp_select_ex':
/home/michael/comp/ipq806x-src/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include/wolfssl/test.h:1805:5: error: impossible constraint in 'asm'
     FD_ZERO(&fds);
     ^~~~~~~
/home/michael/comp/ipq806x-src/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include/wolfssl/test.h:1807:5: error: impossible constraint in 'asm'
     FD_ZERO(&errfds);
     ^~~~~~~

Not sure if memset will help ? I tried your Makefile and got this compile error as well, just replace fd_zero with memset , not sure if it is valid but it compiled, and wolfssl command seem to work as well

1 Like

Thanks I’ll give that a go!

Swapping out FD_ZERO for memset seems good enough for my purposes and i got it compiling. Appreciate the assistance.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.