Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MeterW1therm] avoid GLOB_BRACE, don't require glibc #470

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

r00t-
Copy link
Contributor

@r00t- r00t- commented Mar 25, 2021

fix #402

UNTESTED ✅

@m-reuter
Copy link
Contributor

m-reuter commented Mar 26, 2021

Thanks, this gets me further. Now I get this error:

/vzlogger/src/vzlogger.cpp: In function 'int main(int, char**)':
/vzlogger/src/vzlogger.cpp:549:10: error: invalid conversion from 'int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, size_t*, void**)' {aka 'int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)'} to 'MHD_AccessHandlerCallback' {aka 'MHD_Result (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)'} [-Werror=permissive]
  549 |          &handle_request, (void *)&mappings, MHD_OPTION_END);
      |          ^~~~~~~~~~~~~~~
      |          |
      |          int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, size_t*, void**) {aka int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)}
In file included from /vzlogger/include/local.h:33,
                 from /vzlogger/src/vzlogger.cpp:55:
/usr/include/microhttpd.h:2443:45: note:   initializing argument 5 of 'MHD_Daemon* MHD_start_daemon(unsigned int, uint16_t, MHD_AcceptPolicyCallback, void*, MHD_AccessHandlerCallback, void*, ...)'
 2443 |                   MHD_AccessHandlerCallback dh, void *dh_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/vzlogger.dir/build.make:85: src/CMakeFiles/vzlogger.dir/vzlogger.cpp.o] Error 1
make[2]: Leaving directory '/vzlogger/build'
make[1]: *** [CMakeFiles/Makefile2:973: src/CMakeFiles/vzlogger.dir/all] Error 2
make[1]: Leaving directory '/vzlogger/build'
make: *** [Makefile:185: all] Error 2

Replication is difficult until the libsml pull request: volkszaehler/libsml#41 is merged. Currently one has to spin up an Alpine docker, install dependencies, run install.sh, edit unity.c to replace the offending line with the APPLE version, continue with install.sh. Unsure if this is a new issue or related.

docker run -it --rm alpine /bin/ash
apk add --no-cache bash \
    build-base git cmake pkgconf \
    subversion autoconf automake \
    libtool sudo \
    util-linux-dev openssl-dev \
    libunistring-dev mosquitto-dev \
    cyrus-sasl-dev gnutls-dev \
    libmicrohttpd-dev libltdl json-c-dev \
    leptonica-dev libgcrypt-dev \
    curl-dev subversion nano
git clone -b avoid_GLOB_BRACE  https://github.com/r00t-/vzlogger.git
cd vzlogger
bash ./install.sh
nano ./libs/libsml/test/unity/unity.c

There, use struct _Unity Unity = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , { 0 } };and remove the full else block. And continue with install.sh.

@r00t-
Copy link
Contributor Author

r00t- commented Mar 26, 2021

Now I get this error:

kind of off-topic here, i suggest you just create a "does not build on alpine" issue and post there, if you find more issues.

apk add --no-cache bash \

i feel sorry for the poor download servers,
i suggest you 'docker commit' just once (or put the commands into a dockerfile) , instead of re-downloading all the packages everytime.

edit unity.c

why not use the fix from my fork?
kind of copy the steps from install.sh into your dockerfile/script and adjust them.
install.sh is not needed, and the steps are really simple,
have a look at https://github.com/volkszaehler/vzlogger/blob/master/.github/workflows/build%2Btest.yml as used by ci.

vzlogger.cpp:549:10: error: invalid conversion from 'int ()(void, MHD_Connection*, [...] [-Werror=permissive]

for that warning, i suggest you remove -Werror from the Makefile or disable local, looks like an incompatible version of microhttpd, will check later.

@r00t- r00t- closed this Mar 26, 2021
@r00t- r00t- reopened this Mar 26, 2021
@m-reuter
Copy link
Contributor

wow @r00t- thanks for all the amazing support. Will follow your advice. Also removing -Werror solves this (although I could not figure out know how to remove -Werror on the cmake command line, adjusting -DCMAKE_CXX_FLAGS did not help). I ran cmake, make, then build the failing file directly with the full c++ without -Werror and continue with make. That way it everything compiles.

@r00t-
Copy link
Contributor Author

r00t- commented Mar 31, 2021

i now tested this one locally on my raspberry pi, the code works.

@r00t- r00t- changed the title WIP: [MeterW1therm] avoid GLOB_BRACE, don't require glibc [MeterW1therm] avoid GLOB_BRACE, don't require glibc Mar 31, 2021
@r00t- r00t- force-pushed the avoid_GLOB_BRACE branch from ed0c0aa to 677b02a Compare March 31, 2021 15:52
@r00t- r00t- force-pushed the avoid_GLOB_BRACE branch from 677b02a to 5278d23 Compare March 31, 2021 15:55
@r00t-
Copy link
Contributor Author

r00t- commented Mar 31, 2021

@andig @mbehr1 :
ok to merge, or is anybody of you bored enough to implement the proper solution using readdir() instead of glob()?

@andig andig merged commit 4341981 into volkszaehler:master Mar 31, 2021
@andig
Copy link
Contributor

andig commented Mar 31, 2021

Grad aus dem Augenwinkel gesehen. Du räumst ja richtig auf... RESPEKT!

@r00t- r00t- mentioned this pull request Apr 10, 2021
@r00t- r00t- mentioned this pull request Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vzlogger requires glibc (was: Cross-compile error: 'GLOB_BRACE' was not declared)
3 participants