majintao0131 / yaml-cpp

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

Build error MacOS. Latest CheckOut. New API #146

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Mac OS 10.7
cmake 
-DCMAKE_INSTALL_PREFIX=/Users/mriedel/MPI/Repositories/humus-sw/TeleKyb2/trunk/s
tacks/telekyb_deps/yaml_wrapper -DBUILD_SHARED_LIBS=ON 
-DYAML_CPP_BUILD_OLD_API=OFF

2. make
3. -> Build error: in emitter.cpp

What is the expected output? What do you see instead?
It builds fine on Ubuntu 11.10.

What version of the product are you using? On what operating system?

Please provide any additional information below.
Previous builds had no problem.

Original issue reported on code.google.com by m...@riedel-privat.de on 16 Jan 2012 at 12:56

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, the problem was that it was using the "old" headers from 
/opt/local/include/yaml-cpp/emitter.h. I think this behavior is new. Should'nt 
the make script first include the local directory before including system 
directories?

I think was no issue in the past.

Original comment by m...@riedel-privat.de on 16 Jan 2012 at 4:00

GoogleCodeExporter commented 9 years ago
Hmm, you're right, I'll check this out.

Original comment by jbe...@gmail.com on 16 Jan 2012 at 7:16

GoogleCodeExporter commented 9 years ago
If it's a OSX thing, I can also try to locate the problem.

Original comment by m...@riedel-privat.de on 16 Jan 2012 at 7:47

GoogleCodeExporter commented 9 years ago
It may be, but I'm on OS X also, and I've installed to /usr/local/include (not 
/opt/local/include), and it works fine.

It may be something strange going on with your $PATH, but I would have expected 
the make script to include the local directory first. I'd be happy if you 
wanted to investigate :)

Original comment by jbe...@gmail.com on 16 Jan 2012 at 8:34

GoogleCodeExporter commented 9 years ago
I'll have two more Macs. Let's see if it's configuration specific. I'll check 
it out tomorrow.

Original comment by m...@riedel-privat.de on 16 Jan 2012 at 8:50

GoogleCodeExporter commented 9 years ago
Ok, I located the problem:

In the root CMakeLists.txt, you have to put

include_directories(${YAML_CPP_SOURCE_DIR}/include)
include_directories(${YAML_CPP_SOURCE_DIR}/src)

before any other include_directories call. Currently, for the new API 
    include_directories(${Boost_INCLUDE_DIRS}) comes first, which causes my error 
(adds /opt/local/include).

I would put it prior to 
if(YAML_CPP_BUILD_OLD_API) ...

Thanks.

Original comment by m...@riedel-privat.de on 18 Jan 2012 at 8:36

GoogleCodeExporter commented 9 years ago
So, apparently your boost installation is not in /usr/local/include :)

Original comment by m...@riedel-privat.de on 18 Jan 2012 at 9:00

GoogleCodeExporter commented 9 years ago
OK, I made this change (rc4ba56b754f9). Can you verify that it works?

By the way, I've switched the new API to its own branch (instead of being a 
compiler flag). So you'll have to update to the "new-api' branch:

hg up new-api

Original comment by jbe...@gmail.com on 21 Jan 2012 at 6:23

GoogleCodeExporter commented 9 years ago
Thanks for the fix. Apart from having to change append to push_back *g, 
everything works fine.

Original comment by m...@riedel-privat.de on 21 Jan 2012 at 11:22

GoogleCodeExporter commented 9 years ago
Oh, sorry about that change - I am trying to keep things generally stable, but 
on the wiki, dan.eloff made a point in favor of push_back that I hadn't thought 
of (that it works with std::back_inserter), and that convinced me.

Original comment by jbe...@gmail.com on 22 Jan 2012 at 12:00

GoogleCodeExporter commented 9 years ago
*g is a smily in Germany. So no problem at all.

Original comment by m...@riedel-privat.de on 22 Jan 2012 at 12:06

GoogleCodeExporter commented 9 years ago
That's really funny! Cultural differences...

Original comment by jbe...@gmail.com on 22 Jan 2012 at 1:14