libiec61850 icon indicating copy to clipboard operation
libiec61850 copied to clipboard

Missing Headers when building inside Docker Container

Open TheBigFudge opened this issue 2 years ago • 7 comments

Hey @mzillgith ,

I am currently containerizing a small application that implements an SV subscriber. For this I want to install the API headers of libiec61850 in the container with "make install".

The build process runs without problems. But unfortunately I noticed that "hal_ethernet.h" is not installed under /usr/local/include, which I need for the SV subscriber. Also there is only the file libiec61850.a under /usr/local/lib and not the shared library object libiec61850.so.

What could be the reason for this? I have already tried several base images. On my development machine (Ubuntu 22.04) the installation of the headers works without problems.

Here is the short Dockerfile I am using:

FROM gcc as builder
LABEL stage=builder

RUN mkdir /libIEC61850
COPY /libiec61850-1.5.1/ /libIEC61850

WORKDIR /libIEC61850/

RUN apt-get update \
	&& apt-get install -y --no-install-recommends\
	# build-essential\
    cmake\
	&& apt-get clean \
	&& rm -rf /var/lib/apt/lists/* \
	&& rm -rf /tmp/*

RUN make INSTALL_PREFIX=/usr/local install

RUN ls -la /usr/local/include/
RUN ls -la /usr/local/lib

TheBigFudge avatar Jun 28 '22 11:06 TheBigFudge

I built the libiec61850 for python in a docker container, afterwards I could get the shared object libiec61850.so maybe try this?

apt update
apt install cmake build-essential python3 swig
cd <folder name of the libiec61850 source files>
mkdir build
cd build
cmake -DBUILD_PYTHON_BINDINGS=ON ..
make

Update: For anyone who is faced with compiling issues regarding Python stack and Linux shared object file, you may consider check the short instruction here: https://gitlab.com/thu_smartgrids/pylibiec61850

I hope this documentation could be helpful!

shuoChenTHU avatar Jul 11 '22 10:07 shuoChenTHU

@shuoChenTHU Could you maybe share your libiec61850.so? :) I'm getting compiler errors all the time.

SpaghettiCodeBooy avatar Jul 18 '22 10:07 SpaghettiCodeBooy

l libiec61850-1.5.1_linux_lib.zip

Hi @SpaghettiCodeBooy , here is the entire libiec61850 I've compiled for Python in Linux environment, including the .so file. It turned out that the source object alone is not enough for Linux, one must put the whole lib into the directory. P.S. I don't really use the GOOSE functions, perhaps my .so file would throw back the same error. Just have a try.

shuoChenTHU avatar Jul 25 '22 13:07 shuoChenTHU

@shuoChenTHU Thank you so much! Saved my Master Thesis 🥇

SpaghettiCodeBooy avatar Jul 26 '22 09:07 SpaghettiCodeBooy

@shuoChenTHU Thank you so much! Saved my Master Thesis 🥇

No big deal. May I ask what is the topic of your master thesis? There is one thing that I haven't yet fixed with the current pyiec61850 for linux. Here is a link of the issue: https://github.com/mz-automation/libiec61850/issues/393

I would appreciate it if you also deal with the MMS report by coincident and could perform an analysis on that issue.

shuoChenTHU avatar Jul 26 '22 09:07 shuoChenTHU

@shuoChenTHU I'm building a Substation Honeypot based on the Library and Docker. Could you maybe share your Docker File, I have no idea at the moment where to copy all the stuff. Then I can verfiy and check about the Report Control Blocks.

SpaghettiCodeBooy avatar Jul 26 '22 10:07 SpaghettiCodeBooy

@SpaghettiCodeBooy my Docker application also involves a py script as a dummy server, could you pm me your email address? Maybe we can talk on some details.

shuoChenTHU avatar Jul 26 '22 13:07 shuoChenTHU