teris / rapidjson

Automatically exported from code.google.com/p/rapidjson
MIT License
0 stars 0 forks source link

perftest does not build on Mac OS X #55

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
After running premake, I ran the suggested make command: make -f test.make 
config=release32 , but it fails to build perftest. Both gtest and unittest 
build OK.

The first error is in reader.h at line 116 "error: '_SIDD_UBYTE_OPS' was not 
declared in this scope". IT also has the same error for _SIDD_CMP_EQUAL_ANY, 
_SIDD_BIT_MASK and _SIDD_NEGATIVE_POLARITY.

I looked through the header files for where these are defined and on my MaC 
system, two preprocessor constants have to be defined: __SSE4_1__ and 
__SSE4_2__ . I see from the perftest.make makefile that you specify the 
-msse4.2 flag, and from what I gather this doesn't enable SSE4.1. To enable 
both, you can use -msse4 (at least for GCC). However, even after chaging it to 
this, the compilation still fails with the same errors.

I then tried defining __SSE4_1__ and __SSE4_2__  in the makefile, but the build 
still errors out with same errors.

Any ideas ?

Original issue reported on code.google.com by keith3...@rocketmail.com on 22 Jan 2013 at 1:44

GoogleCodeExporter commented 8 years ago
Just realised my gcc version is 4.2 and the -msse4.2 flag was only implemented 
in gcc 4.3+

After doing the following, it compiled fine:

1) Check which version of gcc is active with by opening a terminal and running 
"gcc --version" 
2) Download MacProst installer for your version of OS X from 
http://www.macports.org/install.php and run installer (easy way to upgrade GCC 
version)
3) Open new terminal window (must be new as PATH environment var is updated 
after MacPorts install)
4) Check which version of gcc you already have installed with "port select 
--list gcc" (NOTE: you probably won't have some of the later versions installed 
already. See next step)
5) Install latest version of gcc (gcc47 at the moment) with "sudo port install 
gcc47" (this will take a while to download)
6) Run "port select --list gcc" again and you should see the new version in the 
list (eg. mp-gcc47)
7) Select this latest version as active gcc version with "sudo port select gcc 
mp-gcc47"
8) Run "gcc --version" again to check the latest version is active

Original comment by keith3...@rocketmail.com on 26 Jan 2013 at 1:11

GoogleCodeExporter commented 8 years ago
First attempt to build for release32 gave me errors about the limits header 
file due to __int128 not being defined. Gnu's official position is that you 
need to roll your own. See answers at following link for more info:

http://stackoverflow.com/questions/13148463/compiling-32bit-binary-expected-unqu
alified-id-before-int128

Building for release64 or debug64 solved this issue, but it still failed to 
build due some warnings about casting away qualifiers in 
test/unittest/readertest.cpp:187:4. As the make file included the compiler flag 
-Werror=cast-qual, these warnings were treated as errors. Removing this flag in 
both unittest and perftest makefiles solved this issue (not ideal solution but 
I wanted to get it building).

There were still linker warnings as the /usr/lib64 folder didn't exist, and the 
makefiles included the flag -L/usr/lib64, but the build was still successful.

SUCCESS - Both unittest_release_x64_gmake and perftest_release_x64_gmake ran 
without problems!

Original comment by keith3...@rocketmail.com on 26 Jan 2013 at 1:49

GoogleCodeExporter commented 8 years ago
In the latest version at https://github.com/miloyip/rapidjson
I found that Debug64, Release64 and Debug32 are OK on clang/OS X. But Debug32 
generate a strange link error about google test.
It may be similar to:
http://stackoverflow.com/questions/21267682/gtest-fails-to-link-on-mac-with-the-
default-compiler

Can you help checking the current version is OK on your platform?

Original comment by milo...@gmail.com on 30 Jun 2014 at 10:49

GoogleCodeExporter commented 8 years ago

Original comment by milo...@gmail.com on 30 Jun 2014 at 10:49

GoogleCodeExporter commented 8 years ago
Issue 58 has been merged into this issue.

Original comment by milo...@gmail.com on 30 Jun 2014 at 10:51

GoogleCodeExporter commented 8 years ago

Original comment by milo...@gmail.com on 13 Jul 2014 at 4:20