`libopenssl-devel` for OpenWrt?

Hello community!

I want to compile a project that uses openssl header files in openwrt. I've installed gcc and lilbopenssl, but can't compile my project since openssl header files are missing. In some linux distros you can install those header files by installing the libopenssl-devel package.

Any idea how I may be able to do this? Should I build openssl from source on my router? or is there a package I could potentially install?


You have to cross compile your package / project with the sdk as there are no dev packages on the targets.


Thanks @juppin, I've set up my environment to cross-compile a project. I followed the helloworld tutorials.

I now got the helloworld tutorials working, I now need to include openssl into my project, but I believe I need to modify the makefile to point to the correct openssl header files. How would I be able to do that?

right now when I try to compile I get this:

/home/coop-2/openwrt/build_dir/target-mipsel_24kc_musl/helloworld-1.0/helloworld.c:2:10: fatal error: openssl/sha.h: No such file or directory
 #include <openssl/sha.h>
compilation terminated.

What's your current "Makefile"?

1 Like

FINALLY figured it out, I had to add +libopenssl to the DEPENDS variable in Package/<packagename> definition. I also needed to add -lssl -lcrypto to the linker script.
Here's my full make file:

include $(TOPDIR)/rules.mk

# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)

# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below

include $(INCLUDE_DIR)/package.mk

# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/helloworld
  TITLE:=Hello, World!

# Package description; a more verbose description on what our package does
define Package/helloworld/description
  A simple "Hello, world!" -application.

# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
        mkdir -p $(PKG_BUILD_DIR)
        cp $(SOURCE_DIR)/* $(PKG_BUILD_DIR)

# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
        $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/helloworld.o -c $(PKG_BUILD_DIR)/helloworld.c
        $(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/helloworld.o -lssl -lcrypto

# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/helloworld/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/usr/bin

# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,helloworld))

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