mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fixed a bug causing solc to crash on startup due to invalid environment settings for locale
This commit is contained in:
parent
29b8965b95
commit
1b9147d7db
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <clocale>
|
||||||
#include <liblll/Compiler.h>
|
#include <liblll/Compiler.h>
|
||||||
#include <libdevcore/CommonIO.h>
|
#include <libdevcore/CommonIO.h>
|
||||||
#include <libdevcore/CommonData.h>
|
#include <libdevcore/CommonData.h>
|
||||||
@ -52,10 +53,20 @@ void version()
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setEnv() {
|
||||||
|
std::setlocale(LC_ALL, "C");
|
||||||
|
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||||
|
if (!std::setlocale(LC_ALL, "")) {
|
||||||
|
setenv("LC_ALL", "C", 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
enum Mode { Binary, Hex, Assembly, ParseTree, Disassemble };
|
enum Mode { Binary, Hex, Assembly, ParseTree, Disassemble };
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
setEnv();
|
||||||
unsigned optimise = 1;
|
unsigned optimise = 1;
|
||||||
string infile;
|
string infile;
|
||||||
Mode mode = Hex;
|
Mode mode = Hex;
|
||||||
|
@ -326,16 +326,6 @@ case $(uname -s) in
|
|||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install eth
|
sudo apt-get -y install eth
|
||||||
|
|
||||||
# And install the English language package and reconfigure the locales.
|
|
||||||
# We really shouldn't need to do this, and should instead force our locales to "C"
|
|
||||||
# within our application runtimes, because this issue shows up on multiple Linux distros,
|
|
||||||
# and each will need fixing in the install steps, where we should really just fix it once
|
|
||||||
# in the code.
|
|
||||||
#
|
|
||||||
# See https://github.com/ethereum/webthree-umbrella/issues/169
|
|
||||||
sudo apt-get -y install language-pack-en-base
|
|
||||||
sudo dpkg-reconfigure locales
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
@ -21,13 +21,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CommandLineInterface.h"
|
#include "CommandLineInterface.h"
|
||||||
|
#include <clocale>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/exception/all.hpp>
|
#include <boost/exception/all.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
void setEnv() {
|
||||||
|
std::setlocale(LC_ALL, "C");
|
||||||
|
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||||
|
if (!std::setlocale(LC_ALL, "")) {
|
||||||
|
setenv("LC_ALL", "C", 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
setEnv();
|
||||||
dev::solidity::CommandLineInterface cli;
|
dev::solidity::CommandLineInterface cli;
|
||||||
if (!cli.parseArguments(argc, argv))
|
if (!cli.parseArguments(argc, argv))
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user