1 (edited by ballsmahoney90 2020-03-17 19:13:03)

Topic: [SOLVED] Confusion about include path

In Chapter 2.4.5 of the wolfSSL-Manual:
"WOLFSSL_USER_SETTINGS if defined allows a user specific settings file to be
used. The file must be named “user_settings.h” and exist in the include path.
This is included prior to the standard “settings.h” file, so default settings can be
overridden."

What (and where) exactly is the include path? I am having all sorts of errors because I am not completely sure where this header file needs to be included. Can anyone point me in the proper direction? I have included my current errors and paths I have tried.

Thank you very much.

Post's attachments

wolfsslerror.png
wolfsslerror.png 629.63 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: [SOLVED] Confusion about include path

Hi @ballsmahoney90,

The include path is a system path that includes various locations where a C compiler might look for headers for example if the system CFLAGS or PATH contains the directory /my/directory and inside of /my/directory there exists an "include" directory your system would have:

/my/directory/include

The C compiler would know about /my/directory so when a .c source file in your application has the directive "#include <myheader.h> the compiler will look for a file named "myheader.h" inside of /my/directory/include/ if it finds it the header will be included, if not an error will be reported.

I see you are running the "make command" as a sudo command too, this is a very bad idea as the resulting executables will all have root access and can only be executed by a root user. root also does not have the same paths as the local user so. Instead run ./configure then make without sudo and only once the application is built would you then want to do "sudo make install".

To help the C compiler find your user_settings.h you can update the CFLAG using the -I (capitol "eye" for Include) directive. For example if I have user_settings.h in /home/kaleb/work/test-location and my Makefile looks like below it won't be able to find my header:

CC=gcc
KALEBS_LIB_DIR=/home/kaleb/work/testDir/wolf-install-dir-for-testing
CFLAGS=-I$(KALEBS_LIB_DIR)/include -Wall
LIBS= -L$(KALEBS_LIB_DIR)/lib -lwolfssl

aes-file-encrypt: aes-file-encrypt.o
    $(CC) -o $@ $^ $(CFLAGS) $(LIBS) 

.PHONY: clean

clean:
    rm -f *.o aes-file-encrypt

Now to update my Makefile so it can find my user_settings.h in /home/kaleb/work/test-location

CC=gcc
KALEBS_LIB_DIR=/home/kaleb/work/test-location
CFLAGS=-I$(KALEBS_LIB_DIR)/include -Wall
LIBS= -L$(KALEBS_LIB_DIR)/lib -lwolfssl

aes-file-encrypt: aes-file-encrypt.o
    $(CC) -o $@ $^ $(CFLAGS) $(LIBS) 

.PHONY: clean

clean:
    rm -f *.o aes-file-encrypt

If you are trying to use a user_settings.h with the configure script I would not recommend that approach instead when using the configure script it will generate the file <wolfssl/options.h> which is the replacement for user_settings.h when building with ./configure.

Warm Regards,

K

3 (edited by ballsmahoney90 2020-03-18 15:48:28)

Re: [SOLVED] Confusion about include path

One problem I have is running wolfssl in a petalinux environment, and I don't believe we are supposed to be editing the makefile for wolfssl. At the moment, I am still confused where to put user_settings.h. I appreciate your response, but is there a way to define where the user_settings.h file is in the ./configure command. Another problem I have is that if I compile without any configure options (which is successful), the compiler cannot find the header files linked despite using -l wolfssl and -l <libraries I have tried>.

My script that I am running to link the wolfssl library to our compiler during :

sudo apt-get update && sudo apt-get dist-upgrade

sudo apt-get install -y git autoconf libtool

cd
git clone https://github.com/wolfssl/wolfssl.git
cd ~/wolfssl
./autogen.sh
./configure --enable-aesccm

make
sudo make install

sudo ldconfig

Which results in the error attached above. What do you recommend as a better method than running ./configure, that would work in a petalinux based environment?

Share

Re: [SOLVED] Confusion about include path

ballsmahoney90,

I apologize if you didn't see the last sentence or if it was unclear. Do not use user_settings.h when using the ./configure command. Instead just have your application include <wolfssl/options.h> which is automatically generated by the configure script.

user_settings.h is ONLY used when ./configure is not available.

Warm Regards,

K