divinity76 / cacdrive

harddrive emulator using cloudatcost's "cloud storage" as a storage backend.
The Unlicense
9 stars 4 forks source link

Error compiling on Ubuntu 18.04 and likely earlier #2

Closed markmay76 closed 5 years ago

markmay76 commented 5 years ago

When compiling under Ubuntu 18.04 I received the following error:

src/main.cpp:143:110: warning: format not a string literal and no format arguments [-Wformat-security] ){macrobacktrace();error_at_line(status,errnum,FILE,LINE,__VA_ARGS__);}

Not being real familiar with c++, I did some searches and found that I needed additional command line options. I compiled it with the following and everything seems to work: g++ src/main.cpp -std=c++17 -lcurl -lpthread -Wno-error=format-security -Wno-format-security

divinity76 commented 5 years ago

@markmay76 hmm, interesting, can you post the full output of g++ ? also please post the output of g++ --version

markmay76 commented 5 years ago

Full output of g++

mmay@panther:~/cacdrive$ g++ src/main.cpp -std=c++17 -lcurl -lpthread
src/main.cpp: In function ‘void cac_update_sectorcode(FILE*, uint64_t, const string&)’:
src/main.cpp:143:110: warning: format not a string literal and no format arguments [-Wformat-security]
 ){macrobacktrace();error_at_line(status,errnum,__FILE__,__LINE__,__VA_ARGS__);}
                                                                             ^
src/main.cpp:2545:3: note: in expansion of macro ‘myerror’
   myerror(EXIT_FAILURE, original_errno,
   ^~~~~~~
mmay@panther:~/cacdrive$ 

The output of g++ --version

mmay@panther:~/cacdrive$ g++ --version
g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

From what I found online, I believe this change is something Ubuntu does different from the normal default. I'm not familiar enough with c++ to track it down, but might be worth mentioning in case others run into it.

divinity76 commented 5 years ago

@markmay76 thanks, i think i know what it is now. can you run git pull and re-run g++ src/main.cpp -std=c++17 -lcurl -lpthread and see if g++ still complains?

markmay76 commented 5 years ago

That solved it.

Thanks for writing this. It is an interesting way to use some of the storage space.

Thanks Mark

On Thu, Sep 13, 2018 at 2:51 PM divinity76 notifications@github.com wrote:

@markmay76 https://github.com/markmay76 can you run git pull and re-run g++ src/main.cpp -std=c++17 -lcurl -lpthread and see if it still complains?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/divinity76/cacdrive/issues/2#issuecomment-421113310, or mute the thread https://github.com/notifications/unsubscribe-auth/APmMo6OENyA9fxyklyN_1L3fsSCXqLxZks5uaqk7gaJpZM4WneG0 .

divinity76 commented 5 years ago

nice :) thank you for taking the time to report it.

btw the count parameter of dd decides how much space you'll get, eg if you want 90gib, use count=23593750 instead of count=10000 when running dd