simetnicbr / simetbox-openwrt-base

Sistema base para instalação do SIMETBox
http://simet.nic.br/simetbox
GNU General Public License v2.0
21 stars 4 forks source link

Criar pacote para instalação em Ubuntu #2

Closed tamusiunas closed 5 years ago

farribeiro commented 7 years ago

Eu estou tentando fazer uma imagem docker como Ubuntu como base e para este ambiente e encontrei 3 problemas na automatização do processo:

Vou tentar buscar a biblioteca faltante, caso encontre farei um pull request ao menos antes do mantedores sanarem este problema. Acho melhor focarem mais no projeto em si (build do firmware) e para o ambiente de desenvolvimento deixar a cargo do desenvolvedor porém amplamente documentado.

farribeiro commented 7 years ago

Para reforçar, a respeito da divisão SIMET, ele não deveria estar agrupado em um único projeto? Em pastas separadas? Um exemplo como os /etc da vida e suas /lib, que compõe o firmware simetbox? Pois, no momento está impossível de montar a firmware de forma separada.

farribeiro commented 7 years ago

A saída do meu build automatizado deste projeto:

git:travis-docker [fribeiro@fabio-docker ~/Documentos/simetbox-openwrt-base]$ docker build . -t simet          
Sending build context to Docker daemon 1.514 MB
Step 1 : FROM ubuntu:latest
 ---> ebcd9d4fca80
Step 2 : MAINTAINER "Fabio Rodrigues Ribeiro <farribeiro@gmail.com>"
 ---> Using cache
 ---> 6c76b05494a7
Step 3 : ADD https://github.com/simetnicbr/simetbox-openwrt-base/archive/master.tar.gz /src/
Downloading [==================================================>] 262.8 kB/262.8 kB
 ---> Using cache
 ---> 84a9bcf4bece
Step 4 : WORKDIR "/src/"
 ---> Using cache
 ---> ecd10dbc12bb
Step 5 : RUN apt-get update
 ---> Using cache
 ---> 5a0b919ec101
Step 6 : RUN apt-get upgrade -y
 ---> Using cache
 ---> aa9b748571df
Step 7 : RUN apt-get install -y     build-essential     dh-autoreconf   libssl-dev  --no-install-recommends
 ---> Using cache
 ---> 708f04cc9bbd
Step 8 : RUN tar zxfv master.tar.gz
 ---> Using cache
 ---> fc0d19d00a9b
Step 9 : WORKDIR "/src/simetbox-openwrt-base-master"
 ---> Running in 84d955c3d3a3
 ---> 88f3ae916ad4
Removing intermediate container 84d955c3d3a3
Step 10 : RUN autoreconf ; exit 0
 ---> Running in edcb70000483
configure.ac:7: error: required file './compile' not found
configure.ac:7:   'automake --add-missing' can install 'compile'
configure.ac:7: error: required file './config.guess' not found
configure.ac:7:   'automake --add-missing' can install 'config.guess'
configure.ac:7: error: required file './config.sub' not found
configure.ac:7:   'automake --add-missing' can install 'config.sub'
configure.ac:4: error: required file './install-sh' not found
configure.ac:4:   'automake --add-missing' can install 'install-sh'
autoreconf: automake failed with exit status: 1
 ---> 54dca0189136
Removing intermediate container edcb70000483
Step 11 : RUN automake --add-missing
 ---> Running in 774dd9d61118
configure.ac:7: installing './compile'
configure.ac:7: installing './config.guess'
configure.ac:7: installing './config.sub'
configure.ac:4: installing './install-sh'
 ---> 156ee802a69e
Removing intermediate container 774dd9d61118
Step 12 : RUN ./configure
 ---> Running in 0516115c5672
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for inttypes.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for uint8_t... yes
checking for strchr... yes
checking for clock_gettime... no
checking for clock_gettime in -lrt... no
checking for config_simet in -lsimetconfig... no
checking for pthread_create in -lpthread... no
checking for pthread_create in -lpthreads... no
checking for static SSL support... disabled
checking for SSL support... checking for SSL include directory... /usr/include
checking for SSL library directory... /usr/lib/x86_64-linux-gnu
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking bits/select.h usability... yes
checking bits/select.h presence... no
configure: WARNING: bits/select.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: bits/select.h: proceeding with the compiler's result
checking for bits/select.h... yes
checking simet_config.h usability... no
checking simet_config.h presence... no
checking for simet_config.h... no
checking for sys/types.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for sys/time.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking for fcntl.h... (cached) yes
checking for netdb.h... (cached) yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking for unistd.h... (cached) yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking for sys/select.h... (cached) yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking for strings.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/filio.h usability... no
checking sys/filio.h presence... no
checking for sys/filio.h... no
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking sys/sysctl.h usability... yes
checking sys/sysctl.h presence... yes
checking for sys/sysctl.h... yes
checking for poll.h... (cached) yes
checking netconfig.h usability... no
checking netconfig.h presence... no
checking for netconfig.h... no
checking netdir.h usability... no
checking netdir.h presence... no
checking for netdir.h... no
checking stropts.h usability... yes
checking stropts.h presence... yes
checking for stropts.h... yes
checking for sys/select.h... (cached) yes
checking for bits/select.h... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking for strrchr... no
checking for int64_t... yes
checking for uint64_t... yes
checking for uint8_t... (cached) yes
checking for bzero... no
checking for gettimeofday... no
checking for memset... no
checking for socket... no
checking for strdup... no
checking for bzero... (cached) no
checking for getaddrinfo... no
checking for gethostname... no
checking for gethostbyname2... no
checking for gethostbyname_r... no
checking for getnameinfo... no
checking for hstrerror... no
checking for if_nametoindex... no
checking for inet_aton... no
checking for inet_pton... no
checking for isfdtype... no
checking for poll... no
checking for pselect... no
checking for select... no
checking for snprintf... no
checking for sockatmark... no
checking for vsnprintf... no
checking for inet_ntoa... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
                 SSL support: enabled
       SSL include directory: /usr/include
       SSL library directory: /usr/lib/x86_64-linux-gnu
              Compiler flags:  -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE
                Linker flags: -ljson-c -lsimetconfig -Wl,--gc-sections -L/usr/lib/x86_64-linux-gnu -lssl -lcrypto
 ---> 02bbf2f8cbbb
Removing intermediate container 0516115c5672
Step 13 : RUN make install
 ---> Running in 3601160125ea
Making install in src
make[1]: Entering directory '/src/simetbox-openwrt-base-master/src'
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT base64.o -MD -MP -MF .deps/base64.Tpo -c -o base64.o base64.c
mv -f .deps/base64.Tpo .deps/base64.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c
utils.c:31:25: fatal error: json-c/json.h: No such file or directory
compilation terminated.
make[1]: *** [utils.o] Error 1
Makefile:508: recipe for target 'utils.o' failed
make[1]: Leaving directory '/src/simetbox-openwrt-base-master/src'
Makefile:376: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
The command '/bin/sh -c make install' returned a non-zero code: 2
git:travis-docker [fribeiro@fabio-docker ~/Documentos/simetbox-openwrt-base]$

O que está sendo executado:

# Base image
FROM ubuntu:latest
MAINTAINER "Fabio Rodrigues Ribeiro <farribeiro@gmail.com>"

ADD https://github.com/simetnicbr/simetbox-openwrt-base/archive/master.tar.gz /src/

WORKDIR "/src/"

RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y \
    build-essential \
    dh-autoreconf \
    libssl-dev \ 
    --no-install-recommends
RUN tar zxfv master.tar.gz

WORKDIR "/src/simetbox-openwrt-base-master"

RUN autoreconf ; exit 0
RUN automake --add-missing
RUN ./configure
RUN make install

O script está ainda em estágio de desenvolvimento, que facilita o rebuild.

farribeiro commented 7 years ago

Corrigido o problema do json-c instalando o pacote libjson0 e libjson0-dev, entretanto dá erro e pede arquivo simet_config.h que provavelmente deve estar nos outros dois projetos.

simet_client.c:26:26: fatal error: simet_config.h: No such file or directory
compilation terminated.
make[1]: *** [simet_client.o] Error 1
Makefile:508: recipe for target 'simet_client.o' failed
make[1]: Leaving directory '/src/simetbox-openwrt-base-master/src'
Makefile:376: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
The command '/bin/sh -c make install' returned a non-zero code: 2
fnokai-zz commented 7 years ago

@farribeiro O projeto simetbox-openwrt-base possui uma dependência do projeto simetbox-openwrt-config. Para compilar o projeto pro OpenWRT, os passos a serem seguidos estão no projeto simetbox-openwrt-feed, lá estão todas dependências necessárias. Ainda não temos um roteiro para realizar a instalação no Ubuntu, mas acredito que instalando essa dependência, você já consiga compilar o projeto.

farribeiro commented 7 years ago

@fnokai eu unifiquei os fontes dos três projetos, e mandei novamente a compilação e retornou outro erro, ainda vou acrescentar os prerrequisitos que encontra no projeto feed vou reproduzir novamente e mais tarde coloco o resultado.

Meu projeto unificado, não unifiquei o openwrt ainda, se encontra aqui[1]

[1]https://github.com/farribeiro/simetbox-openwrt-unified

farribeiro commented 7 years ago

Conforme prometido segue log do build unificado, utilizando os mesmos comandos:

git:master [fribeiro@fabio-docker ~/Documentos/simetbox-openwrt-unified]$ docker build . -t simet
Sending build context to Docker daemon 2.564 MB
Step 1 : FROM ubuntu:latest
 ---> ebcd9d4fca80
Step 2 : MAINTAINER "Fabio Rodrigues Ribeiro <farribeiro@gmail.com>"
 ---> Using cache
 ---> aabb689b4c84
Step 3 : ADD https://github.com/farribeiro/simetbox-openwrt-unified/archive/master.tar.gz /src/
Downloading 446.5 kB
 ---> Using cache
 ---> afcc5335b28b
Step 4 : WORKDIR "/src/"
 ---> Using cache
 ---> 845445de842c
Step 5 : RUN apt-get update
 ---> Using cache
 ---> 02f23c8da0a3
Step 6 : RUN apt-get upgrade -y
 ---> Using cache
 ---> 387d2cadcb57
Step 7 : RUN apt-get install -y     build-essential     dh-autoreconf   libssl-dev  libjson0    libjson0-dev    --no-install-recommends
 ---> Using cache
 ---> 4b07b785484d
Step 8 : RUN tar zxfv master.tar.gz
 ---> Using cache
 ---> 15383d9adb30
Step 9 : WORKDIR "/src/simetbox-openwrt-unified-master"
 ---> Using cache
 ---> 98b0820ef285
Step 10 : RUN autoreconf ; exit 0
 ---> Using cache
 ---> 644b6a38e87c
Step 11 : RUN automake --add-missing
 ---> Using cache
 ---> b42d55773193
Step 12 : RUN ./configure
 ---> Using cache
 ---> 38b8bff34efc
Step 13 : RUN make install
 ---> Running in 2490badd93a9
Making install in src
make[1]: Entering directory '/src/simetbox-openwrt-unified-master/src'
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT simet_config.lo -MD -MP -MF .deps/simet_config.Tpo -c -o simet_config.lo simet_config.c
libtool: Version mismatch error.  This is libtool 2.4.2 Debian-2.4.2-1ubuntu1, but the
libtool: definition of this LT_INIT comes from libtool 2.4.6.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2 Debian-2.4.2-1ubuntu1
libtool: and run autoconf again.
Makefile:421: recipe for target 'simet_config.lo' failed
make[1]: *** [simet_config.lo] Error 63
make[1]: Leaving directory '/src/simetbox-openwrt-unified-master/src'
make: *** [install-recursive] Error 1
Makefile:396: recipe for target 'install-recursive' failed
The command '/bin/sh -c make install' returned a non-zero code: 2
git:master [fribeiro@fabio-docker ~/Documentos/simetbox-openwrt-unified]$

Irei trocar então a imagem base para ver se a compilação ocorre. Daqui a pouco coloco o log, os comandos serão os mesmos, conforme a documentação deste projeto

farribeiro commented 7 years ago

Troquei a imagem base de ubuntu(xenial) para debian(jessie) compilou sem problemas, com meu projeto unificado, agora falta os demais passos para compilação da firmware:

make[1]: Entering directory '/src/simetbox-openwrt-unified-master/src'
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT simet_config.lo -MD -MP -MF .deps/simet_config.Tpo -c -o simet_config.lo simet_config.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT simet_config.lo -MD -MP -MF .deps/simet_config.Tpo -c simet_config.c  -fPIC -DPIC -o .libs/simet_config.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT simet_config.lo -MD -MP -MF .deps/simet_config.Tpo -c simet_config.c -o simet_config.o >/dev/null 2>&1
mv -f .deps/simet_config.Tpo .deps/simet_config.Plo
/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o libsimetconfig.la -rpath /usr/local/lib simet_config.lo  
libtool: link: gcc -shared  -fPIC -DPIC  .libs/simet_config.o    -O2   -Wl,-soname -Wl,libsimetconfig.so.0 -o .libs/libsimetconfig.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libsimetconfig.so.0" && ln -s "libsimetconfig.so.0.0.0" "libsimetconfig.so.0")
libtool: link: (cd ".libs" && rm -f "libsimetconfig.so" && ln -s "libsimetconfig.so.0.0.0" "libsimetconfig.so")
libtool: link: ar cru .libs/libsimetconfig.a  simet_config.o
libtool: link: ranlib .libs/libsimetconfig.a
libtool: link: ( cd ".libs" && rm -f "libsimetconfig.la" && ln -s "../libsimetconfig.la" "libsimetconfig.la" )
make[2]: Entering directory '/src/simetbox-openwrt-unified-master/src'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ../libtool   --mode=install /usr/bin/install -c   libsimetconfig.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libsimetconfig.so.0.0.0 /usr/local/lib/libsimetconfig.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libsimetconfig.so.0.0.0 libsimetconfig.so.0 || { rm -f libsimetconfig.so.0 && ln -s libsimetconfig.so.0.0.0 libsimetconfig.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libsimetconfig.so.0.0.0 libsimetconfig.so || { rm -f libsimetconfig.so && ln -s libsimetconfig.so.0.0.0 libsimetconfig.so; }; })
libtool: install: /usr/bin/install -c .libs/libsimetconfig.lai /usr/local/lib/libsimetconfig.la
libtool: install: /usr/bin/install -c .libs/libsimetconfig.a /usr/local/lib/libsimetconfig.a
libtool: install: chmod 644 /usr/local/lib/libsimetconfig.a
libtool: install: ranlib /usr/local/lib/libsimetconfig.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/usr/local/include'
 /usr/bin/install -c -m 644 simet_config.h '/usr/local/include'
make[2]: Leaving directory '/src/simetbox-openwrt-unified-master/src'
make[1]: Leaving directory '/src/simetbox-openwrt-unified-master/src'
make[1]: Entering directory '/src/simetbox-openwrt-unified-master'
make[2]: Entering directory '/src/simetbox-openwrt-unified-master'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/src/simetbox-openwrt-unified-master'
make[1]: Leaving directory '/src/simetbox-openwrt-unified-master'
 ---> e4a0277238a9
Removing intermediate container 3fe669b161b3
Successfully built e4a0277238a9
farribeiro commented 7 years ago

Agora estou devendo um teste com o projeto base. Logo posto um log

farribeiro commented 7 years ago

Link para o PR #7

farribeiro commented 7 years ago

Log do projeto não unificado os fontes, usando debian:

Making install in src
make[1]: Entering directory '/src/simetbox-openwrt-base-master/src'
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT base64.o -MD -MP -MF .deps/base64.Tpo -c -o base64.o base64.c
mv -f .deps/base64.Tpo .deps/base64.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c
utils.c: In function 'obtem_modelo':
utils.c:875:2: warning: 'modelo_digitos' may be used uninitialized in this function [-Wmaybe-uninitialized]
  return modelo_digitos;
  ^
mv -f .deps/utils.Tpo .deps/utils.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT dns.o -MD -MP -MF .deps/dns.Tpo -c -o dns.o dns.c
mv -f .deps/dns.Tpo .deps/dns.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT simet_dns_ping_traceroute.o -MD -MP -MF .deps/simet_dns_ping_traceroute.Tpo -c -o simet_dns_ping_traceroute.o simet_dns_ping_traceroute.c
simet_dns_ping_traceroute.c: In function 'main_dns_ping_traceroute':
simet_dns_ping_traceroute.c:100:5: warning: 'ret_ws' is used uninitialized in this function [-Wuninitialized]
  if (ret_ws)
     ^
mv -f .deps/simet_dns_ping_traceroute.Tpo .deps/simet_dns_ping_traceroute.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT simet_porta25.o -MD -MP -MF .deps/simet_porta25.Tpo -c -o simet_porta25.o simet_porta25.c
mv -f .deps/simet_porta25.Tpo .deps/simet_porta25.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT simet_uptime.o -MD -MP -MF .deps/simet_uptime.Tpo -c -o simet_uptime.o simet_uptime.c
mv -f .deps/simet_uptime.Tpo .deps/simet_uptime.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT netsimet.o -MD -MP -MF .deps/netsimet.Tpo -c -o netsimet.o netsimet.c
mv -f .deps/netsimet.Tpo .deps/netsimet.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT protocol.o -MD -MP -MF .deps/protocol.Tpo -c -o protocol.o protocol.c
mv -f .deps/protocol.Tpo .deps/protocol.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT protocol_event.o -MD -MP -MF .deps/protocol_event.Tpo -c -o protocol_event.o protocol_event.c
mv -f .deps/protocol_event.Tpo .deps/protocol_event.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT protocol_handler.o -MD -MP -MF .deps/protocol_handler.Tpo -c -o protocol_handler.o protocol_handler.c
mv -f .deps/protocol_handler.Tpo .deps/protocol_handler.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT rtt_test.o -MD -MP -MF .deps/rtt_test.Tpo -c -o rtt_test.o rtt_test.c
mv -f .deps/rtt_test.Tpo .deps/rtt_test.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT results.o -MD -MP -MF .deps/results.Tpo -c -o results.o results.c
mv -f .deps/results.Tpo .deps/results.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT tcp_test.o -MD -MP -MF .deps/tcp_test.Tpo -c -o tcp_test.o tcp_test.c
tcp_test.c: In function 'tcp_upload_test':
tcp_test.c:522:36: warning: unused variable 'occupied_buff' [-Wunused-variable]
  int length, lowat = 0, free_buff, occupied_buff, buf_size, max_buf_size, state_cork = 1, state_nodelay = 1;
                                    ^
tcp_test.c:522:25: warning: unused variable 'free_buff' [-Wunused-variable]
  int length, lowat = 0, free_buff, occupied_buff, buf_size, max_buf_size, state_cork = 1, state_nodelay = 1;
                         ^
mv -f .deps/tcp_test.Tpo .deps/tcp_test.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT udp_test.o -MD -MP -MF .deps/udp_test.Tpo -c -o udp_test.o udp_test.c
mv -f .deps/udp_test.Tpo .deps/udp_test.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT jitter_test.o -MD -MP -MF .deps/jitter_test.Tpo -c -o jitter_test.o jitter_test.c
mv -f .deps/jitter_test.Tpo .deps/jitter_test.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT latency_test.o -MD -MP -MF .deps/latency_test.Tpo -c -o latency_test.o latency_test.c
latency_test.c: In function 'latency_download_test':
latency_test.c:56:14: warning: variable 'time_s' set but not used [-Wunused-but-set-variable]
     uint64_t time_s;
              ^
mv -f .deps/latency_test.Tpo .deps/latency_test.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT server_finder.o -MD -MP -MF .deps/server_finder.Tpo -c -o server_finder.o server_finder.c
mv -f .deps/server_finder.Tpo .deps/server_finder.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT gopt.o -MD -MP -MF .deps/gopt.Tpo -c -o gopt.o gopt.c
mv -f .deps/gopt.Tpo .deps/gopt.Po
gcc -DHAVE_CONFIG_H -I.     -Wall -I/usr/include/json-c -DNDEBUG -Os -ffunction-sections -fdata-sections -DNTRACE -MT simet_client.o -MD -MP -MF .deps/simet_client.Tpo -c -o simet_client.o simet_client.c
simet_client.c:26:26: fatal error: simet_config.h: No such file or directory
 #include "simet_config.h"
                          ^
compilation terminated.
Makefile:496: recipe for target 'simet_client.o' failed
make[1]: *** [simet_client.o] Error 1
make[1]: Leaving directory '/src/simetbox-openwrt-base-master/src'
make: *** [install-recursive] Error 1
Makefile:364: recipe for target 'install-recursive' failed
The command '/bin/sh -c automake --add-missing  && ./configure  && make install' returned a non-zero code: 2
farribeiro commented 7 years ago

~Extinguirei o meu projeto de unificação para dar um novo entendimento da entrega contínua a partir de tarball dos projetos no github.~ Já está no ar!

No pull request é baseado puramente usando os fonte do projeto base do sem a unificação, enquanto o meu novo provisionamento unifica e provisona até o make menuconfig. Apenas solicito recomendação o uso do Debian para geração do projeto.

tamusiunas commented 7 years ago

@farribeiro O projeto foi inicialmente dividido em três porque facilita algumas coisas:

Arquivo Descrição
/usr/bin/simet_client * Cliente para realização de teste de latência, jitter, perda de pacotes e vazão
/usr/bin/simet_ws * Cliente WEB (CLI) com suporte a https
/usr/bin/simet_hash_measure Busca um identificador único para uma sessão de testes
/usr/bin/get_mac_address.sh Retorna o MAC address da LAN. Este é um identificador único por dispositivo
/usr/bin/get_model.sh Retorna o modelo do equipamento
/usr/bin/get_lat_long.sh Retorna latitude e longitude do equipamento com precisão máxima de 150 metros
/usr/bin/get_simet_box_version.sh Retorna a versão do sistema ("Release version number" da compilação)
/etc/config/simet.conf Arquivo de configuração do SIMETBox
/usr/bin/simet_geolocation.sh Envia a geolocalização aproximada do equipamento (a melhor precisão é de 150 metros.
/usr/bin/run_simet.sh Roda um conjunto de testes do SIMET (testes relacionados a resolução 574 da ANATEL)

*Link para /usr/bin/simet_tools

farribeiro commented 7 years ago

Como relatei com Ubuntu não foi possível, devido a versão do libtool é mais recente o que não ocorre com o debian, meu atual script de provisionamento[1] e minha imagem[2]

Falta agora fazer um patch para o .config do openwrt para ficar o provisionamento completo da firmware. Entretanto, configurei com o make menuconfig manualmente conforme documentado e obtive o erro abaixo:

root@27702efdac75:/src/openwrt-master# make -j 8
 make[1] world
 make[2] tools/install
 make[2] package/cleanup
 make[3] -C tools/flock compile
 make[3] -C tools/flock install
 make[3] -C tools/tar compile
make -r world: build failed. Please re-run make with -j1 V=s to see what's going on
/src/openwrt-master/include/toplevel.mk:192: recipe for target 'world' failed
make: *** [world] Error 1
root@27702efdac75:/src/openwrt-master#

[1] https://github.com/farribeiro/simetbox-openwrt-unified [2] https://hub.docker.com/r/farribeiro/simetbox-openwrt/

farribeiro commented 7 years ago

Como o PR não foi mergeado ou fechado, atualizado branch.

Porém ainda não tem a entrega contínua, somente o ambiente para compilação, ainda é necessário fazer patch do .config, ver se o não dá o erro acima e empurrar a firmware para o github automaticamente com travis-ci.org

farribeiro commented 7 years ago

Como relatei com Ubuntu não foi possível, devido a versão do libtool é mais recente o que não ocorre com o debian, meu atual script de provisionamento[1] e minha imagem[2]

Falta agora fazer um patch para o .config do openwrt para ficar o provisionamento completo da firmware. Entretanto, configurei com o make menuconfig manualmente conforme documentado e obtive o erro abaixo:

root@27702efdac75:/src/openwrt-master# make -j 8
make[1] world
make[2] tools/install
make[2] package/cleanup
make[3] -C tools/flock compile
make[3] -C tools/flock install
make[3] -C tools/tar compile
make -r world: build failed. Please re-run make with -j1 V=s to see what's going on
/src/openwrt-master/include/toplevel.mk:192: recipe for target 'world' failed
make: *** [world] Error 1
root@27702efdac75:/src/openwrt-master#

[1] https://github.com/farribeiro/simetbox-openwrt-unified [2] https://hub.docker.com/r/farribeiro/simetbox-openwrt-unified/

Fiquei por uns dias sem vontade de insistir neste problema e hoje (ontem) talvez por descuido lendo mais atentamente a documentação do projeto simetbox-openwrt-feed diz que é para usar o branch chaos-calmer e não o branch master do openwrt. Então neste ponto está praticamente pronto a geração da firmware de forma automatizada, a não ser por questões futuras dos projetos vier alterar a forma de configuração. Estarei devendo aperfeiçoamentos.

O que tenho atualmente uma imagem, no dockerhub, com ambiente pronto para geração da firmware, está funcional ~porém existem inconsistências, que acima expliquei~. Corrigido inconsistências.

Este texto é somente para registro, aplicarei correções num momento futuro.

farribeiro commented 7 years ago

Aos mantedores,

Devido a disponibilização do ultimo Debian (versão 9, codinome Stretch) é necessário rever as dependências dos ./configure para que seja "homologado". Em meus testes as dependências/ compilações entretanto não está "homologado" para Ubuntu (codinome Xenial) conforme anunciado. Será necessário abertura de PR com as alterações a serem feitas? Está funcional somente para Debian 8 (codinome Jessie).

No aguardo posição para que possa tomar medidas de alterações profundas no projeto.

farribeiro commented 7 years ago

@fnokai @tamusiunas repasse esta questão acima para o time do NIC se manterão ou será necessário intervenção da comunidade para manter o código simetbox atualizado. Estou pensando em abrir um Issue novinho para essa questão.

Abraços.

hmh commented 6 years ago

Para o SIMETBOX baseado em OpenWRT 15.05, existem problemas ao se tentar o build em Debian 9/stretch. Esses problemas são do próprio OpenWRT, mas dada a expectativa de sobrevida tanto do Debian 8/jessie (que será suportado pela equipe debian-lts mesmo depois de caducar o suporte como oldstable), quanto do OpenWRT 15.05, não vale o esforço de corrigi-los.

Cabe notar que o SIMETBOX funciona bem com o OpenWRT 15.05 atualizado (branch for-15.05 das diversas git trees), mesmo não tendo havido nenhuma release oficial recente em tarballs (nem do OpenWRT 15.x, nem do SIMET).

Estamos trabalhando em corrigir o código do SIMET para que funcione adequadamente em LEDE 17.01 (compila, mas não roda -- pelo menos em algumas das plataformas), e depois disso, para o LEDE+OpenWRT master (os dois projetos estão finalmente unificando novamente).

farribeiro commented 6 years ago

Eu fiz um provisionamento com docker do ambiente e falta apenas customizar/automatizar a compilação e sua publicação. A respeito do branch eu não consegui em meus testes, no começo deste ano, gerar uma compilação. Somente no especificado na documentação.

Quanto as dependências nem mesmo o proprio simetbox compila para o stretch e olha lá... é Debian. Ubuntu então, nem se fala.

PR https://github.com/simetnicbr/simetbox-openwrt-base/pull/7

hmh commented 6 years ago

Eu fui impreciso na comunicação...

É possível o cross-build para OpenWRT 15.05 em "Debian 8 (jessie)", mas não em "Debian 9 (stretch)". Isso é um problema com o OpenWRT 15.05, não com o SIMETBOX.

Já para a versão 17.01 e versão master do LEDE/OpenWRT, parece ser necessário utilizar "Debian 9 (stretch)" para o cross-build.

Em ambos o caso, é um cross-build para OpenWRT. E supostamente funciona para qualquer plataforma suportada pelo OpenWRT (inclusive x86), embora internamente só estejamos utilizando MIPS em produção na 15.05, e testando ARM na 17.01 (não está funcional ainda).

A versão atual do SIMETBOX NÃO compila para uso nativo em Debian ou Ubuntu. Mesmo adicionando a principal biblioteca que está faltando (libubox), precisaria alterar diversos scripts (no mínimo), que são específicos para ambiente OpenWRT. E para build nativo, o ideal seria converter muito do simet_tools para usar libcurl, etc.

farribeiro commented 6 years ago

Eu fui impreciso na comunicação...

É possível o cross-build para OpenWRT 15.05 em "Debian 8 (jessie)", mas não em "Debian 9 (stretch)". Isso é um problema com o OpenWRT 15.05, não com o SIMETBOX.

Primeiramente, existe problemas ao montar ambiente, pois o simet rejeita os debian-based mais recentes, somente aceita no Debian 8 (jessie).

Já para a versão 17.01 e versão master do LEDE/OpenWRT, parece ser necessário utilizar "Debian 9 (stretch)" para o cross-build.

Em ambos o caso, é um cross-build para OpenWRT. E supostamente funciona para qualquer plataforma suportada pelo OpenWRT (inclusive x86), embora internamente só estejamos utilizando MIPS em produção na 15.05, e testando ARM na 17.01 (não está funcional ainda).

Não questiono uma versão em especial, apenas experimentei compilar usando o branch master do openWRT sem sucesso, somente com o branch indicado na documentação, o chaos-calmer

A versão atual do SIMETBOX NÃO compila para uso nativo em Debian ou Ubuntu. Mesmo adicionando a principal biblioteca que está faltando (libubox), precisaria alterar diversos scripts (no mínimo), que são específicos para ambiente OpenWRT. E para build nativo, o ideal seria converter muito do simet_tools para usar libcurl, etc.

Se você verificar os códigos e os meus comentários não falo em nenhum momento sobre gerar pacotes para o Debian/Ubuntu ou até mesmo RHEL. Refiro ao ambiente de compilação (cross-build) para o firmware. Se você fizer o cross-build com Ubuntu se não me engano 16.04 ele dá erro de dependência.

O meu instituo, a minha ajuda, é fazer um Continuous integration / Continuous Deployment para o projeto usando https://travis-ci.org onde é possível gerar e publicar os binários automaticamente.

hmh commented 6 years ago

Não testei com branch master do openwrt ou do lede ainda, pode ser que não funcione de jeito nenhum neles, mesmo (talvez nem compile). Os branchs nos quais estamos trabalhando no momento são:

for-15.05/chaos_calmer (produção) lede-17.01 (alpha -- segfaults e alguns problemas funcionais ou de integração no simetbox)

Assim que o lede-17.01 funcionar bem, tentaremos suportar o master do lede-project.org (que deve passar a ser o master do openwrt daqui a algum tempo).

Deveria ser possível o cross-compile funcional da simetbox+openwrt chaos_calmer usando como base a última atualização do Debian 8 ou do Ubuntu LTS 14.04 (sim, são versões antigas) dentro de um container Docker, por exemplo, pelo menos para os diversos targets ar71xx "generic".

farribeiro commented 6 years ago

Deveria ser possível o cross-compile funcional da simetbox+openwrt chaos_calmer usando como base a última atualização do Debian 8 ou do Ubuntu LTS 14.04 (sim, são versões antigas) dentro de um container Docker, por exemplo, pelo menos para os diversos targets ar71xx "generic".

É possível e funciona normalmente, com chaos_calmer e Debian 8. Pode utilizar https://travis-ci.org para entregar seus binários sem problemas

farribeiro commented 6 years ago

@hmh Em complemento a sua explanação do openwrt e lede, da nota do BR-Linux: https://br-linux.org/2018/01/anunciada-a-unificacao-do-openwrt-e-lede.html

Forks são comuns no universo FOSS. Discordâncias técnicas e até mesmo filosóficas, ou implicância entre membros podem gerar novos projetos. E as vezes fica complicado julgar quando um fork foi útil, ou gerou apenas mais software no mundo. A exemplo do que aconteceu com o LXQt, onde dois projetos de matéria convergente, os projetos LEDE e OpenWrt anunciaram a reunificação após alguns meses negociação.

Ambos projetos estão felizes em anunciar esta manobra, que exigiu um trabalho árduo para levantar as questões específicas da reunificação, e que teve muitas propostas e poucas ações. A nova e unificada versão do OpenWrt será governada pelas regras estabelecidas pelo projeto LEDE. Membros ativos de ambos os projetos continuarão a trabalhar na versão unificada do OpenWrt.

O Fork LEDE e seu merge de volta ao OpenWrt não alterará a direção técnica adotada pela unificação dos projetos. A busca por estabilidade e lançamentos de manutenção ao mesmo tempo que lançamentos menores são executado para endereçar bugs críticos e incidentes de segurança, continuará funcionando nos mesmo moldes do que foi feito com o LEDE 17.01.

Versões anteriores ao OpenWrt 15.05 CC(chaos calmer) não serão suportadas pelo merge, e serão abandonadas sem atualizações de segurança e estabilidade. A versão OpenWrt 15.05 CC receberá uma quantidade limitada de correções de segurança, e não estará totalmente integrada ao esquema de automatização de lançamentos, fazendo com que os binários demorem um pouco mais a serem lançados. O LEDE 17.01 continuará a receber suporte contínuo a correções de estabilidade e segurança para os binários e fontes. Em breve haverá uma nova versão disponível.

O projeto unificado irá utilizar a base de códigos-fonte do LEDE. Patches específicos do OpenWrt que atingirem os critérios de qualidade impostos pelo LEDE serão integrados a árvore. O código-fonte será hospedado em git.openwrt.org e terá um espelhamento no Github. O código original do OpenWrt será arquivado no Github para referências futuras. Pull requests para os repositórios do OpenWrt e LEDE atuais serão fechados após um período de 30 dias. É encorajado as pessoas que possuem patches pendentes que corram atrás para que tenham seus trabalhos aplicados na árvore.

A reunificação do projeto OpenWrt é representada pela SPI(Software in the Public Interest), uma organização sem fins lucrativos US 501(c)(3) que está gerenciando o registro da marca OpenWrt, as doações para o projeto, e auxiliando as questões legais envolvidas no processo.

A infraestrutura disponível atualmente no domínio lede-project.org será movida ao domínio openwrt.org e redirecionamentos serão configurados onde for apropriado. O que será feito com fóruns e wikis de ambos os projetos ainda não foi decidido, ficando em seus domínios até que um consenso seja atingido.

Para matéria na íntegra, acesse o link de referência, e para aqueles desconhecem a história por trás da separação dos projetos a cerca de 1 ano e meio atrás, o seguinte link é uma boa compilação de todos os eventos.Referência: forum.lede-project.org

farribeiro commented 6 years ago

Link para Issue https://github.com/simetnicbr/simetbox-openwrt-base/issues/12

farribeiro commented 6 years ago

Link to issue https://github.com/simetnicbr/simetbox-openwrt-feed/issues/4

farribeiro commented 6 years ago

Link Issue https://github.com/simetnicbr/simetbox-openwrt-feed/issues/5#issuecomment-388609703

hmh commented 6 years ago

Resposta "oficial":

Será endereçado em versão futura do software SIMET que serve de "motor de medição" para o SIMETBOX, que está em desenvolvimento no nic.br e já está sendo desenvolvida para funcionar independentemente de estar embarcada em uma SIMETBOX ou não.

Mas aceitaríamos patches para a versão corrente do SIMET, se alguém precisou e teve o trabalho de escrevê-los. ;-)

Isso dito, como a versão atual do simetbox no github funciona em openwrt-18.06 e lede-17.01, e é compilável em Debian stable e Ubuntu 16.x/17.x (não testei ainda no 18.x) caso seja feito um "port" da única lib exclusiva do OpenWRT que é usada pelo motor de medição do simetbox atual, é possível portar o resto da "cola" (scripts e lógica) existente na simetbox para registro com os servidores do sistema SIMET, etc.

farribeiro commented 6 years ago

Essa Issue, por minha parte, necessita ser reescrita para que torne mais legível retirando logs desnecessário de alegações da mudança de nomes do pacotes libjson-c e mais clareza no meu objetivo nesta Issue. De minha parte poderia encerrar pois não diz a respeito de funcionalidades e nem bug a este projeto em questão. Somente a validação das dependências, o mesmo digo para a Issue #3 .

Atualmente mantenho projeto no github com ambiente para geração de firmware, container via docker, com imagem debian stretch

hmh commented 5 years ago

Estamos entrando na reta final para iniciar a remoção de quase toda a funcionalidade do simet legado.

O simet2 está em beta e já vem com suporte docker e pacotes nativos Debian e Ubuntu. Quem quiser usar em Linux, favor utilizar o projeto simetnicbr/simet-ma.

Fechando essa issue, já que não iremos criar pacotes Linux do simet legado.