-
Notifications
You must be signed in to change notification settings - Fork 2
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
Compiling Issues #2
Comments
Hi, There are plenty of issues compiling Linux code on a cygwin environment on Windows. Mainly because of issues with file, event and timing. Fortunately the Demo Code contains hooks for Windows. Thanks Ralf |
Heya, thanks for the quick answer. :) S10history.cpp:83:20: error: ‘STDERR_FILENO’ was not declared in this scope
|
Hi, actually there should be an include file that defines them like this: #ifndef STDOUT_FILENO #ifndef STDERR_FILENO Don`t know in cygwin were this is handled. Please try |
Thanks a lot. :) /usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lrlog If I see it correctly it now has trouble with rlog. But basically g++ seems to be finding rlog. Before I copied it to /usr/include g++ was complaing about not finding the rlog source code for compilation. I also added /usr/include (or rather /cygdrive/c/cygwin/usr/include) to $PATH and $LD_LIBRARY_PATH and exprorted both variables prior to compilation.
|
Hi, so please add to you compile line: |
Thanks for your time. :) And sorry for all the questions. I also have a Mini-PC running Linux Mint. Unfortunately rlog doesn't seem to be available in the Linux Mint repository. :( And it also is not simply possible to replace all rError and rWarning by printf. The syntax of identical but you are using rlog on A LOT more (EG: rDebug, rInfo). So simply removing it doesn't work without mostly rewriting everything. :( No change with the added parameters. I hope I understodd how they work correctly. I don't understand what exactly it is looking for, though. From my understanding it is looking for a file or directly named "-lrlog" which obviously doesn't exist.
|
Hi, |
OK, now you lost me. :) Why do you need a compiled rlog? In your tool you're using the rlog header files. What are those needed for when you need a pre-compiled rlog anyway? oO Anyway I compiled rlog now and copied the bunch of files from the .libs directory it created to /usr/local/lib
|
OK, Next step is to invoke the linker to collect all needed object files and create an executable file from it. And now we have to distinguish between static libraries ".a" and dynamic libraries ".so". If you hand over a static library ".a" to the linker together with your object code it will embed that static library in the executable. So that executable will contain your code and the library as one program. So your problem is that you will have to generate a dynamic library of rlog. This normally is done when you compile the sources of rlog and do a "make install". That will compile several .o files and combine them in a rlog.so file or/and a rlog.a file and install that file in the location that was given to autoconf. You have to locate the rlog.so file and set the -Wl.rpath, or the linker will not find it and cannot assemble your object code to an executable. Ralf |
Thanks for the explanation. :) I indeed did forget the "make install" for rlog. :( Make install created a librlog.a file in /usr/local/lib . /usr/bin/g++ -lrlog -Irlog -O2 -Wl,-rpath,/usr/local/lib -DWINNT -DSTDERR_FILENO=2 -Wall S10history.cpp RscpReader.cpp RscpProtocol.cpp AES.cpp SocketConnection.cpp -o S10history Rlog installation:
|
Is the librlog.a a dynamic or static library? If this does not work try it without -lrlog switch |
Digioso@DigiSlave ~ Digioso@DigiSlave ~ Aaaand this worked :) /usr/bin/g++ -O2 -DWINNT -DSTDERR_FILENO=2 -Wall S10history.cpp RscpReader.cpp RscpProtocol.cpp AES.cpp SocketConnection.cpp /usr/local/lib/librlog.a -o S10history Digioso@DigiSlave ~/S10history Digioso@DigiSlave ~/S10history |
Perfect. I just compiled it under the Linux App on Windows 10. Makefile has to be changed to: all: $(ROOT_VALUE) $(ROOT_VALUE): clean clean: Sorry for cheating, I removed the -Wall to concentrate on errors Ralf |
OK, the Linux APP would've been indeed an alternative to Cygwin. :) |
I rewrote your getYearperDay.sh example into a Perl program and added installation date as a required parameter (so that you cannot request dates prior to installation of the E3DC system). Sample output: Digioso@DigiSlave ~/S10history ./daily.pl YYYY Year cannot be lower than the installation year. The script has to be put into the same directoy as S10history binary. Example config.ini file: And the script:
|
Heya,
thanks for this tool!
I'm trying to compile this on Windows 10 PC within a Cygwin installation.
I downloaded the rlog 1.4 source code from here and copied it to /usr/include
Looks fine as far as I can see. However your code seems to be having lots of issues unfortunately and cannot be compiled. Could you perhaps have a look at this?
I don't think that it has to do with my, let's say unusual setup. I'm using E3DC-Control for example, which I can compile without any issues.
Digioso@DigiSlave ~
$ git clone https://github.com/RalfJL/S10history.git
Cloning into 'S10history'...
cd Sremote: Enumerating objects: 49, done.
remote: Total 49 (delta 0), reused 0 (delta 0), pack-reused 49
Unpacking objects: 100% (49/49), done.
Digioso@DigiSlave ~
$ cd S10history/
Digioso@DigiSlave ~/S10history
$ make
rm S10history
/usr/bin/g++ -lrlog -Irlog -O2 -Wall S10history.cpp RscpReader.cpp RscpProtocol.cpp AES.cpp SocketConnection.cpp -o S10history
S10history.cpp: In function ‘int main(int, char**)’:
S10history.cpp:83:20: error: ‘STDERR_FILENO’ was not declared in this scope
83 | StdioNode stdLog( STDERR_FILENO, StdioNode::OutputChannel);
| ^~~~~~~~~~~~~
S10history.cpp:126:11: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
126 | putenv("TZ=UTC");
| ^~~~~~~~
RscpReader.cpp: In function ‘int handleResponseValue(RscpProtocol*, SRscpValue*)’:
RscpReader.cpp:379:11: warning: variable ‘ucBatteryIndex’ set but not used [-Wunused-but-set-variable]
379 | uint8_t ucBatteryIndex = 0;
| ^~~~~~~~~~~~~~
RscpReader.cpp: In function ‘int db_value_container(RscpProtocol*, std::vector)’:
RscpReader.cpp:176:8: warning: ‘val.db_value_container(RscpProtocol, std::vector)::val_t::consumption’ may be used uninitialized in this function [-Wmaybe-uninitialized]
176 | printf("[%d]-%s-CSV: %d;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f\n", graph_index, value_prefix, (int) d, val.bat_in, val.bat_out, val.bat_charge_level, val.production, val.grid_in,
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177 | val.grid_out, val.consumption);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RscpReader.cpp:176:8: warning: ‘val.db_value_container(RscpProtocol, std::vector)::val_t::bat_in’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:176:8: warning: ‘val.db_value_container(RscpProtocol, std::vector)::val_t::grid_out’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:176:8: warning: ‘val.db_value_container(RscpProtocol, std::vector)::val_t::bat_charge_level’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:176:8: warning: ‘val.db_value_container(RscpProtocol, std::vector)::val_t::bat_out’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:176:8: warning: ‘val.db_value_container(RscpProtocol, std::vector)::val_t::grid_in’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:176:8: warning: ‘val.db_value_container(RscpProtocol, std::vector)::val_t::production’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp: In function ‘int db_sum_container(RscpProtocol, std::vector)’:
RscpReader.cpp:291:8: warning: ‘sum.db_sum_container(RscpProtocol, std::vector)::sum_t::grid_out’ may be used uninitialized in this function [-Wmaybe-uninitialized]
291 | printf("%s-CSV: %d;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f\n", sum_prefix, (int) start.seconds, sum.bat_in, sum.bat_out, sum.bat_charge_level, sum.production, sum.grid_in, sum.grid_out,
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292 | sum.consumption);
| ~~~~~~~~~~~~~~~~
RscpReader.cpp:291:8: warning: ‘sum.db_sum_container(RscpProtocol, std::vector)::sum_t::bat_charge_level’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:291:8: warning: ‘sum.db_sum_container(RscpProtocol, std::vector)::sum_t::bat_in’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:291:8: warning: ‘sum.db_sum_container(RscpProtocol, std::vector)::sum_t::grid_in’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:291:8: warning: ‘sum.db_sum_container(RscpProtocol, std::vector)::sum_t::consumption’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:291:8: warning: ‘sum.db_sum_container(RscpProtocol, std::vector)::sum_t::bat_out’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpReader.cpp:291:8: warning: ‘sum.db_sum_container(RscpProtocol, std::vector)::sum_t::production’ may be used uninitialized in this function [-Wmaybe-uninitialized]
RscpProtocol.cpp:46:2: warning: #warning No time source is available. [-Wcpp]
46 | #warning No time source is available.
| ^~~~~~~
RscpProtocol.cpp: In member function ‘bool RscpProtocol::setHeaderTimestamp(SRscpFrame)’:
RscpProtocol.cpp:48:16: error: ‘struct SRscpFrameHeader’ has no member named ‘timeSec’
48 | frame->header.timeSec = 0;
| ^~~~~~~
RscpProtocol.cpp:49:16: error: ‘struct SRscpFrameHeader’ has no member named ‘timeNanosec’
49 | frame->header.timeNanosec = 0;
| ^~~~~~~~~~~
SocketConnection.cpp: In function ‘int SocketConnect(const char*, int)’:
SocketConnection.cpp:55:9: warning: unused variable ‘iRetries’ [-Wunused-variable]
55 | int iRetries = 3;
| ^~~~~~~~
make: *** [Makefile:9: S10history] Error 1
Digioso@DigiSlave ~/S10history
$ echo $?
2
Digioso@DigiSlave ~/S10history
$
The text was updated successfully, but these errors were encountered: