Commit Graph

289 Commits

Author SHA1 Message Date
Riccardo Spagni 62d2a55719
Merge pull request #2600
885c773a cmake: print which stack trace lib is used (redfish)
2017-10-15 18:49:11 +02:00
Riccardo Spagni 1740f0a13e
Merge pull request #2583
27fdaaa4 Fix building with -DARCH=default -DNO_AES=ON (moneromooo-monero)
2017-10-15 18:37:14 +02:00
Jaquee 1cf940f2a1 epee http_client SSL support 2017-10-15 17:29:04 +02:00
Jaquee eec1013785 CMakeLists.txt - Add openssl include dir 2017-10-15 17:25:26 +02:00
redfish 2051f89fbe cmake: build tests last
Keep -Werror for src, contrib and do not pass it for tests/
2017-10-08 20:47:50 -04:00
redfish 885c773af3 cmake: print which stack trace lib is used
To avoid the suprize of stack tracing being enabled
but libunwind not being linked in.
2017-10-07 12:13:31 -04:00
moneromooo-monero 27fdaaa409
Fix building with -DARCH=default -DNO_AES=ON 2017-10-06 08:47:03 +01:00
Riccardo Spagni 031f486e12
Merge pull request #2486
8b1acc9a Fix OpenSSL 1.1 detection for static builds (hyc)
2017-09-25 20:25:29 +02:00
Riccardo Spagni 7b8398eed7
Merge pull request #2485
a3691ae3 daemon: fix static building with libzmq (iDunk5400)
2017-09-25 20:25:10 +02:00
Riccardo Spagni b911130a46
Merge pull request #2442
e29282d2 build: auto update version info without manually deleting version.h (stoffu)
2017-09-25 16:50:35 +02:00
redfish 504311128d cmake: make warning about headers not fatal
Warning issued on older boost and/or OS:

In file included from /usr/include/boost/asio/detail/socket_types.hpp:61:0,
                 from /usr/include/boost/asio/detail/epoll_reactor.hpp:30,
                 from /usr/include/boost/asio/detail/reactor.hpp:21,
                 from /usr/include/boost/asio/detail/impl/task_io_service.ipp:24,
                 from /usr/include/boost/asio/detail/task_io_service.hpp:198,
                 from /usr/include/boost/asio/impl/io_service.hpp:71,
                 from /usr/include/boost/asio/io_service.hpp:767,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:20,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:21,
                 from /home/vagrant/slave/monero-static-alpine-3_5-x86_64/build/src/common/download.cpp:32:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
2017-09-24 11:25:16 -04:00
redfish 0a70ba2c01 cmake: fix setting of -Werror
Setting COMPILE_FLAGS (or COMPILE_OPTIONS) property directly does not
end up on the command line (even though it should because
add_compile_options does just that).

Also, set -Werror for tests as well, because no warnings now.

Not set for 'external' only because simply moving add_compile_options
above add_subdirectory(external) doesn't do it, and moving add_usbdirectory
down is too big of a change (it will pick up new flags).

-Werror set only for GCC on Linux, since warnings not yet
cleared for other compilers/systems.
2017-09-24 11:25:11 -04:00
iDunk5400 a3691ae31c
daemon: fix static building with libzmq 2017-09-23 12:34:02 +02:00
stoffu e29282d208
build: auto update version info without manually deleting version.h 2017-09-21 07:47:37 +09:00
hyc 8b1acc9a86 Fix OpenSSL 1.1 detection for static builds 2017-09-20 01:38:43 +01:00
Thomas Winget 0299cb77ca
Fix various oversights/bugs in ZMQ RPC server code
- Add some RPC commands (and touch up a couple others)
- some bounds checking
- some better pointer management
- const correctness and error handling

-- Thanks @vtnerd for type help with serialization and CMake changes
2017-09-05 12:20:40 -04:00
Thomas Winget 77986023c3
json serialization for rpc-relevant monero types
Structured {de-,}serialization methods for (many new) types
which are used for requests or responses in the RPC.

New types include RPC requests and responses, and structs which compose
types within those.

# Conflicts:
#	src/cryptonote_core/blockchain.cpp
2017-09-05 12:20:27 -04:00
Jaquee f233c01c8f CMakeLists.txt - ios/xcode fix 2017-08-05 19:21:10 +02:00
Roberto Oliveira 44bfe6048b enable monero build on ppc64le architecture
Fix wrong flags for ppc64le:
-maes - not avaiable
-march - changed by -mcpu that does the same for powerpc
2017-06-27 17:06:19 +00:00
jethro e1f3dfccc8 Add readline support to cli
This PR adds readline support to the daemon and monero-wallet-cli. Only
GNU readline is supported (e.g. not libedit) and there are cmake checks
to ensure this.

There is a cmake variable, Readline_ROOT_DIR that can specify a
directory to find readline, otherwise some default paths are searched.

There is also a cmake option, USE_READLINE, that defaults to ON. If set
to ON, if readline is not found, the build continues but without
readline support.

One negative side effect of using readline is that the color prompt in
the wallet-cli now has no color and just uses terminal default. I know
how to fix this but it's quite a big change so will tackle another time.
2017-06-18 10:08:37 -04:00
stoffu dd8e3266b2
shared libs build (i.e. make debug) 2017-05-17 10:17:08 +09:00
hyc e65d66fe04 Fix ARM64 identification
The actual arch flag the compiler recognizes is "armv8-a".
This is true for both gcc and clang.
2017-04-12 23:54:33 +01:00
Riccardo Spagni e9ca165b1a
Merge pull request #1950
f5bd3465 IOS CMAKE build settings (Jaquee)
d8a88d05 add IOS CMAKE toolchain (Jaquee)
2017-04-11 00:26:15 +02:00
moneromooo-monero a8ac4f0a70
update easylogging++ to latest upstream 2017-04-10 21:05:02 +01:00
Jaquee f5bd346573
IOS CMAKE build settings 2017-04-03 18:38:50 +02:00
Christoph Schnerch 33f3cfdec0 set USE_LTO_DEFAULT to false 2017-03-20 13:24:30 +01:00
Gareth 088930facc Problem: misleading information about LMDB storage
Solution: updated the comments to reflect the current situation in terms of LMDB implementation and no longer recommend 'memory' for blockchain storage in production use.
2017-03-08 21:29:08 +08:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
Riccardo Spagni 058eed369b
cmakify openssl 2017-02-21 17:11:12 +02:00
moneromooo-monero f640512c53
Optionally query moneropulse DNS records to check for updates
It just checks and prints a message if there is a new version
for now.
2017-02-20 22:58:16 +00:00
Riccardo Spagni c64e10c2d7
Merge pull request #1700
73785263 backtrace_symbols() requires -lexecinfo on dragonflybsd (Dan Miller)
2017-02-12 23:20:27 +02:00
Dan Miller 7378526393 backtrace_symbols() requires -lexecinfo on dragonflybsd
freebsd also needs -lexecinfo for backtrace()
2017-02-09 11:22:12 -08:00
kenshi84 8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
MoroccanMalinois c833a39a4d cmake set atomic for android 2017-02-05 04:33:33 +01:00
moneromooo-monero cd34fc655d
Use easylogging++'s stack trace facility where possible
This avoids using libunwind, which often causes trouble.
2017-02-04 12:33:03 +00:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
Riccardo Spagni ec323d8c3f
Merge pull request #1561
d561f4ad enable clang checks that were disabled (Chris Vickio)
0aefb2f6 remove std::move from return statements (pessimizing-move warning) (Chris Vickio)
629d5b76 change counter from bool to int (deprecated-increment-bool warning) (Chris Vickio)
fb76d439 add extra braces around subobjects (missing-braces warning) (Chris Vickio)
3b6d5f25 make struct/class declarations consistent (mismatched-tags warning) (Chris Vickio)
fcf66925 remove unused fields from network_throttle (unused-private-field warning) (Chris Vickio)
296f8c16 inline unused function (for unused-function warning) (Chris Vickio)
2017-01-15 19:01:08 -05:00
Chris Vickio d561f4ad92 enable clang checks that were disabled 2017-01-15 19:23:33 +03:00
NanoAkron e68ea86cc4
Change logic of testing for libunwind on OSX and ARM 2017-01-09 16:39:44 +00:00
Riccardo Spagni 2a996f492f
Merge pull request #1510
80abc3bc Build wallet with Android NDK (MoroccanMalinois)
2017-01-08 16:40:02 -08:00
MoroccanMalinois 80abc3bc4a Build wallet with Android NDK 2017-01-05 01:11:05 +00:00
Randi Joseph 52db01ea6d Silence CMake policy warning on macos.
See: https://cmake.org/cmake/help/v3.0/policy/CMP0042.html
2016-12-23 02:54:34 -05:00
Antonio Huete Jimenez b00da61eab Preliminary support for DragonFly BSD
- It builds but no further testing has been done.
2016-12-15 02:27:53 -08:00
NanoAkron b9c5f29d1d
Revert forcing -fPIC for all ARMv8 builds 2016-12-09 12:01:16 +00:00
NanoAkron 65528aef4e
Always compile Position Independent Code on 64-bit ARMv8 systems 2016-11-12 00:26:49 +00:00
NanoAkron a269f03e5d
Report Boost library version during compilation 2016-10-27 21:38:29 +01:00
Riccardo Spagni 2025e8241c
Merge pull request #1105
344e96c remove check for certain clang versions (Dan Miller)
b73bed2 Don't define stdc++ on FreeBSD (Dan Miller)
2016-09-26 17:32:14 +02:00
Dan Miller 344e96cc08 remove check for certain clang versions 2016-09-21 06:42:21 -07:00
Dan Miller b73bed2992 Don't define stdc++ on FreeBSD 2016-09-19 16:19:54 -07:00
NanoAkron b8fb9d1919 Fix test for 'ARM_ID' as caught by @radfish in #1088 2016-09-18 22:56:38 +01:00
Riccardo Spagni da6f7d99f8
fix conflict 2016-09-18 20:22:43 +02:00
Riccardo Spagni 4a03a8a1da
Merge pull request #1094
06bb692 cmake: support BUILD_SHARED_LIBS built-in option (redfish)
e1c7af3 cmake: transitive deps and remove deprecated LINK_* (redfish)
54010b9 crypto: armv7: slow-hash: remove redundant source include (redfish)
2016-09-18 11:44:08 +02:00
redfish 06bb6923c3 cmake: support BUILD_SHARED_LIBS built-in option
Support building internal libraries as shared. This reduces
development time by eliminating the need to re-link all
binaries every time non-interface code in the library changes.
Instead, can hack on libxyz, then `make libxyz`, and re-run
monerod.

By default BUILD_SHARED_LIBS is OFF in release build type,
and ON in debug build type, but can be overriden with -D.
2016-09-18 02:56:26 -04:00
NanoAkron 7f00a4abf4 +crypto for ARMv8 now tests and modifies ${ARCH$ 2016-09-18 03:26:18 +01:00
NanoAkron fd82635396 Updated +crypto option for ARMv8 to modify ${ARCH} instead 2016-09-18 03:23:15 +01:00
NanoAkron d76aec6121 Add +crypto flag for ARMv8-a 2016-09-17 22:13:39 +01:00
redfish c79104086c cmake: quotes around ARCH_ID string
It's only blank only if somebody running cmake in MSYS/MinGW (Windows)
manually forgets to add -D ARCH, but when it is blank, without quotes
those lines are invalid cmake syntax.
2016-09-17 15:36:15 -04:00
redfish aa9a64556d cmake: remove redundant checks around CMAKE_{AR,RANLIB}
Those are always set, no point in checking. #1065
2016-09-17 00:04:08 -04:00
iDunk5400 1855213c8f Attempt to fix broken compilation on some systems caused by #1074 2016-09-10 22:56:40 +02:00
Riccardo Spagni 1d0578f8d3
Merge pull request #1047
0f94f61 cmake: handle dists which prefix gcc binaries wth arch triplet (redfish)
2016-09-10 15:11:16 +02:00
Riccardo Spagni 7bebbbe5fe
Merge pull request #1040
77fa663 cmake: split BUILD_GUI_DEPS option into two (redfish)
2016-09-10 15:10:08 +02:00
Riccardo Spagni 011c94c622
change CMake project name 2016-09-03 21:38:20 +02:00
redfish 77fa663e94 cmake: split BUILD_GUI_DEPS option into two
The split is to make this software more packageable. 'make install'
is used by the package building scripts, and should not be installing
vendored dependencies onto the system.
2016-09-03 12:55:20 -04:00
Ilya Kitaev 43677f9d68 gui/libwallet_merged: libunbound is one more dependency 2016-09-03 13:32:06 +03:00
redfish e374ae7eeb cmake: option+target for profiling for coverage 2016-09-01 10:47:43 -04:00
redfish 0f94f61805 cmake: handle dists which prefix gcc binaries wth arch triplet
Issue #1026
2016-08-31 22:21:22 -04:00
NanoAkron cf10e05cc6 Add ARMv8 Handling to CMakeLists.txt - version 2
Adds 64-bit ARMv8 handling to CMakeLists.txt and implements GCC flags for two errata on the Cortex-A53 present on every chip in revision 0:

https://developer.arm.com/docs/epm048406/latest/arm-processor-cortex-a53-mpcore-product-revision-r0-software-developers-errata-notice

835769 affects 64-bit multiply accumulate

843419 affects internal page addressing

Rewritten to build on @radfish's changes

Updated to address @radfish's points
2016-08-30 00:57:55 +01:00
redfish 442adfbfaa cmake: define a default build type
Lets 'cmake .. && make' be sufficient to build.
2016-08-28 19:39:00 -04:00
Riccardo Spagni 53a0997a26
Merge pull request #997
1c7d3b0 cmake: define ARM var for all ARM arch variants (redfish)
6fe543d cmake: ARM: exclude libunwind in static build (redfish)
397b720 make: remove NO_AES from arm targets (redfish)
57ca3f3 make: make the ARM release targets statically linked (redfish)
43c07a1 readme: editted install/build instructions for clarity (redfish)
a0d4058 Revert "makefile: remove unnecessary ARM-specific targets" (redfish)
c2bc34b Revert "Interpret x86_64 as x86-64 for architecture" (redfish)
c54b9a1 cmake: don't set ARCH from CMAKE_SYSTEM_PROCESSOR (redfish)
2016-08-28 22:49:09 +02:00
Riccardo Spagni c706035c12
Merge pull request #995
94de4b0 cmake: pass -static when STATIC=ON on Windows (redfish)
2016-08-28 22:48:09 +02:00
Riccardo Spagni e9d4d224e3
Merge pull request #992
f1ba51c remove -Wall from coverage arguments (Jacob Torrey)
f017fec Build the core_tests under Travis (Jacob Torrey)
e0bf02a Streamline release-test target (Jacob Torrey)
baf4574 Update badge to point to monero's coveralls (Jacob Torrey)
d1dc2c3 Re-enable Travis IRC notifications (Jacob Torrey)
9c71b9e Silence coveralls to prevent 4MB logs (Jacob Torrey)
65041fb Disabled libwallet_api_test until Issue #895 resolved (Jacob Torrey)
a450138 Disable core_tests on Travis-CI (Jacob Torrey)
650afac Added -j2 to Makefile and clean up matrix (Jacob Torrey)
256dec0 Streamline test building target (Jacob Torrey)
14915c2 Ensure tests are built prior to testing (Jacob Torrey)
fe4992b Added coverage g++ commands (Jacob Torrey)
497b24f Update .travis.yml (Jacob Torrey)
678467d Update for the current make environment (Jacob Torrey)
abcac26 Fixed tab/space issue on YAML (Jacob Torrey)
7351a11 Converted to a build matrix for testing and release (Jacob Torrey)
342dbfb Prep for coveralls (Jacob Torrey)
2016-08-28 22:44:37 +02:00
moneromooo-monero 9e82b694da
remove original Cryptonote blockchain_storage blockchain format 2016-08-28 21:27:32 +01:00
redfish 1c7d3b05a9 cmake: define ARM var for all ARM arch variants
This is refactoring only. No behavior change.
2016-08-28 12:55:33 +00:00
redfish 6fe543dcd4 cmake: ARM: exclude libunwind in static build
Else error in build with STATIC=ON:

cd /home/redfish/bitmonero/build/release/src/miner && /usr/bin/cmake -E
cmake_link_script CMakeFiles/simpleminer.dir/link.txt --verbose=1
/usr/bin/c++    -std=c++11 -D_GNU_SOURCE  -Wall -Wextra -Wpointer-arith
-Wundef -Wvla -Wwrite-strings -Wno-error=extra
-Wno-error=deprecated-declarations -Wno-unused-parameter
-Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef
-Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized
-Wno-reorder -Wno-missing-field-initializers -march=armv7-a
-fno-strict-aliasing -mfloat-abi=hard -DNDEBUG -O2  -flto
-ffat-lto-objects   -static-libgcc -static-libstdc++
-Wl,--wrap=__cxa_throw CMakeFiles/simpleminer.dir/simpleminer.cpp.o  -o
../../bin/simpleminer -rdynamic -Wl,-Bstatic -lrt -Wl,-Bdynamic -ldl
../cryptonote_core/libcryptonote_core.a ../common/libcommon.a
-Wl,-Bstatic -lboost_filesystem -lboost_program_options -lboost_regex
-lboost_chrono -lboost_system -lboost_thread -Wl,-Bdynamic -pthread
-Wl,-Bstatic -lrt -Wl,-Bdynamic -ldl ../blockchain_db/libblockchain_db.a
../cryptonote_core/libcryptonote_core.a
../blockchain_db/libblockchain_db.a
../../contrib/otshell_utils/libotshell_utils.a ../blocks/libblocks.a
../common/libcommon.a ../../external/unbound/libunbound.a -lssl -lcrypto
-lunwind -Wl,-Bstatic -lboost_program_options ../crypto/libcrypto.a
-lboost_date_time -lboost_serialization -lboost_filesystem
../../external/db_drivers/liblmdb/liblmdb.a -Wl,-Bdynamic -pthread
-Wl,-Bstatic -lboost_chrono -lboost_system -lboost_thread -lrt
-Wl,-Bdynamic -ldl
/usr/bin/ld: ../../bin/simpleminer: hidden symbol
`__aeabi_unwind_cpp_pr0' in
/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/6.1.1/libgcc_eh.a(unwind-arm.o)
is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
2016-08-28 07:20:39 -04:00
redfish c2bc34b736 Revert "Interpret x86_64 as x86-64 for architecture"
This reverts commit 8623492150.

Let's restrict ARCH to values accepted by -march to keep things clear
and consistent. ARCH is -march, with only one exception: a value of
"default" indicates to not pass -march at all.
2016-08-28 02:10:36 -04:00
redfish c54b9a1a05 cmake: don't set ARCH from CMAKE_SYSTEM_PROCESSOR
It is not correct to do so, because ARCH should only take values
supported by the -march argument, with the exception of 'default'
which denotes not passing -march at all.

ARCH defines the target architecture for builds that are intended to be
portable to other machines.
2016-08-28 01:37:34 -04:00
redfish 94de4b040c cmake: pass -static when STATIC=ON on Windows
This gets rid of bitmonerod.exe's dependecy on libwindpthreads-1.dll in build
on Windows on x86_64 (via MSYS2 default toolchain). With this patch all DLL
dependencies are on DLLs in c:\windows\system32.
2016-08-27 20:26:39 -04:00
Jacob Torrey f1ba51cf89 remove -Wall from coverage arguments 2016-08-27 06:29:19 -06:00
Jacob Torrey fe4992b1dc Added coverage g++ commands
Signed-off-by: Jacob Torrey <torreyj@ainfosec.com>
2016-08-26 14:03:27 -06:00
Riccardo Spagni e152fd20e9
Merge pull request #964
2a2b655 Build: make boost 1.58 minimum requirement. Fixes #956 (anonimal)
2016-08-22 22:52:51 +02:00
anonimal 2a2b6550ad
Build: make boost 1.58 minimum requirement. Fixes #956 2016-08-16 12:59:15 +00:00
anonimal 44dab04d88
Build: use libstdc++ with clang < 3.7 2016-08-16 12:04:05 +00:00
redfish 33b5ebd055 cmake: do not pass -O2 in debug build on ARM
Also, minor cleanup of redundant flag-setting code.
2016-08-01 22:03:53 -04:00
redfish 35dc40af42 cmake: libatomic only needed for 32-bit Clang builds 2016-07-28 23:26:51 -04:00
redfish 042db0bd0f cmake: cleanup logic that sets flags per target/subdir
The previous logic that used a COMMON_*_FLAGS intermediate variable
and then re-assigned CMAKE_*_FLAGS before including each subdirectory
was confusing and ugly. This PR is the right way to do it.

This commit is purely refactoring: built binaries unchanged.
2016-07-28 21:20:50 -04:00
redfish 0f990d0183 cmake,common: flag for stack trace
By default the flag is enabled whenever libunwind is found on the
system, with the exception of static build on OSX (for which we can't
install the throw hook #932 due to lack of support for --wrap in OSX
ld64 linker).
2016-07-27 01:52:33 -04:00
redfish 4b3a7885ac cmake: install throw hook in OSX build too
This is an attempt to fix build with STATIC=ON on OSX (#932):

[ 95%] Linking CXX executable ../../bin/bitmonerod Undefined symbols for
architecture x86_64: "___real___cxa_throw", referenced from:
___wrap___cxa_throw in libcommon.a(stack_trace.cpp.o) ld: symbol(s) not found
for architecture x86_64
2016-07-26 02:30:59 +00:00
redfish 3c92c2f096 cmake: do not install hook on throw when building tests
This fixes build of tests with STATIC=ON, which failed with:

/tmp/cc8lNtqY.ltrans12.ltrans.o: In function
`boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error>
>::rethrow() const [clone .lto_priv.41]':
cc8lNtqY.ltrans12.o:(.text+0x4e): undefined reference to `__wrap___cxa_throw'

The hook is implemented in libcommon, which is not linked into some of the test
binaries.  An alternative solution is to link all tests against libcommon,
but that seems worse because it introduces a false dependency (also,
I tried that and for some of the test binaries the linker still failed to
pick up the symol from libcommon, strangely.)
2016-07-26 02:20:16 +00:00
redfish dca9fe175c cmake: do not pass -Werror when building tests
The tests currently issue a warning that
"warning: -fassociative-math disabled; other options take precedence"

The associative math optimization is turned on indirectly by -Ofast.
Apparently, the optimization is forced to be disabled, while compiling
test harnesses generated by Google Test framework.

Unfortunately, there is no -Wno-error=* flag to disable this warning
(see gcc --help=warnings).

An alternative to this patch is to disable the optimization explicitly
with -fno-associative-math, but that seems worse.

Another alternative is to not pass -Ofast for tests build, but we
want the tests to be built with exact same optimization flags as
the code being tested, otherwise the value of the tests is diminished.

Another alternative is to remove -Werror from the entire build, but
it's good to include that flag to preclude people leaving warnings.

A note regarding implementation of not passing -Werror for tests:
I considered filtering out -Werror from CMAKE_{C,CXX}_FLAGS but
that seems to be worse because it's surprizing behavior, to those
reading the code that adds -Werror. It is better to add it for
when it is used and not added otherwise. I also considered relying
on order, adding -Werror after inluding 'tests' subdir, but before
including the other subdirs, but that also seems cryptic to the
reader. So, I settled with the current solution, of explicitly
setting CMAKE_{C,CXX}_FLAGS to different values before including the
respective subdir.

Testing done: compared compiler invocation for non-tests source files
using `make VERBOSE=1` with and without this commit: the only difference
is the position of -Werror. So, this commit doesn't change the binary.
2016-07-22 18:08:33 -04:00
Riccardo Spagni 48e14ef66c
fix atomic library to only fire off for clang 2016-07-20 14:25:59 +02:00
Riccardo Spagni 39f7fad71d
fix duplicate clang block in cmake 2016-07-20 14:24:50 +02:00
Riccardo Spagni 77015e8132
Merge pull request #904
f07f120 cmake: don't try to link with atomic on Apple (redfish)
19349d7 cmake: ARM: clang: make warning non-fatal: inline asm (redfish)
f3e09f3 cmake: link with -latomic for clang (redfish)
f4b35ae cmake: include -ldl via cmake built-in var (redfish)
fa85cd8 common: stack trace: make clang happy with func ptrs (redfish)
4dce26b cmake: do not pass -stdlib=c++ to clang >=3.7 (redfish)
2016-07-20 13:56:59 +02:00
Riccardo Spagni 255ff79416
Merge pull request #896
1e89f4f cmake: do not ignore dangerous warnings with -Wno-error (redfish)
2016-07-20 13:51:54 +02:00
redfish f07f120e5d cmake: don't try to link with atomic on Apple
-latomic is necessary with Clang on Linux, but
apparently, on OSX it's not found.
2016-07-12 00:25:56 -04:00
redfish 19349d7870 cmake: ARM: clang: make warning non-fatal: inline asm
Clang issues a warning for some inline asm in stack_trace.cpp.  This
patch ieaves the warning to be displayed as a reminder to fix
the code.
2016-07-10 21:27:00 -04:00
redfish f3e09f36d3 cmake: link with -latomic for clang
otherwise clang build fails with

../cryptonote_core/libcryptonote_core.a(miner.cpp.o): In function
`std::__atomic_base<unsigned long long>::load(std::memory_order) const':
/usr/bin/../lib/gcc/i686-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/atomic_base.h:396:
undefined reference to `__atomic_load_8'

This has no effect on the gcc build.

The one strange thing is that test code like

std::atomic<int> x;
int main() { return x; }

compiles and links without errors with clang, without -latomic.  This
alone would suggest that this patch is unnecessary, but that is not the
case. It's not clear exactly why, though. The bitmonero code is
including the same header, but it must be doing something more complex
than in this test code snippet that causes the failure at link time
pasted above. In any case, passing -latomic fixes the problem and
seems safe.

.
2016-07-10 21:27:00 -04:00
redfish f4b35aeafd cmake: include -ldl via cmake built-in var
This does two things:
1. fixes clang build, which otherwise errors with undefined symbol
'dlsym'.
2. simplifies the cmake script, delegating to cmake to figure
   out platform-specific flags for linking against the dl library.
2016-07-10 21:27:00 -04:00
redfish 4dce26bba4 cmake: do not pass -stdlib=c++ to clang >=3.7
Tested on Linux (Arch) with clang 3.7 and 3.8 i686 and ARM:
if -stdlib=c++ is passed to clang, then the build errors
out with <string>,<iostrea>,etc. headers not found. Simply
not passing the arg fixes the problem.

**NOTE**: not tested on OSX.
2016-07-10 21:19:16 -04:00
redfish 1e89f4f2c5 cmake: do not ignore dangerous warnings with -Wno-error
Shorten the list of warnings that are reported, but
which are forced to NOT generate an error, via -Wno-error.

Unwhitelist these: strict-aliasing, sign-compare, type-limits

For example, ignoring strict-aliasing warning caused
lots of wasted time diagnosing Issue #847.
2016-07-09 11:59:07 -04:00
redfish ab250754f2 cmake: pass -fno-strict-aliasing to fix build with GCC 6.1.1
This patch is a temprorary workaround until aliasing is fixed in the
code (Issue #847).
2016-07-08 21:42:05 -04:00