codegooglecom / libproxy

Automatically exported from code.google.com/p/libproxy
GNU Lesser General Public License v2.1
0 stars 0 forks source link

strdup and gethostbyname not declared in this scope #160

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.cmake ./
2.make
3.

What is the expected output? What do you see instead?
Successful compile.

/tmp/libproxy-0.4.6/libproxy/proxy.cpp: In function ‘char** 
px_proxy_factory_get_proxies(pxProxyFactory_*, const char*)’:
/tmp/libproxy-0.4.6/libproxy/proxy.cpp:432: error: ‘strdup’ was not 
declared in this scope
make[2]: *** [libproxy/CMakeFiles/libproxy.dir/proxy.cpp.o] Error 1
make[1]: *** [libproxy/CMakeFiles/libproxy.dir/all] Error 2
make: *** [all] Error 2

What version of the product are you using? On what operating system?
libproxy 0.4.6
Mac OS X 10.7 (Lion)

Please provide any additional information below.
The symbols are now defined in /usr/lib/system/libsystem_c.dylib rather than 
/usr/lib/libSystem.B.dylib

I can bypass the strdup issue in proxy.cpp by manually adding the function 
declaration. if I do so I get a similar error for gethostbyname. If do the same 
for pacrunner_webkit.cpp I get a link error, even if I set the appropriate 
LDFLAGS.

Original issue reported on code.google.com by mschamsc...@gmail.com on 10 Apr 2011 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by dominiqu...@gmail.com on 18 Apr 2011 at 7:54

GoogleCodeExporter commented 9 years ago
YOu could get a glimse at gnulib

Original comment by roucarie...@gmail.com on 1 May 2011 at 11:53

GoogleCodeExporter commented 9 years ago
So on OS X they decided that strdup() is no longer declared by string.h, or is 
the include missing ? Or OS X 10.7 require different link argument ?

Original comment by nicolas.dufresne@gmail.com on 2 May 2011 at 6:02

GoogleCodeExporter commented 9 years ago
I tried to compile lib proxy with jhbuild on MacOSX 10.7.2 and stumbled over 
the same issue as mentioned here. string.h still defines the strdup function 
but the function definition is not included as the _POSIX_C_SOURCE=1 is set. To 
get it compiling I removed the following line in the libproxy/CMakeLists.txt 
file:
add_definitions(-D_POSIX_C_SOURCE=1)

Original comment by moser.ro...@gmail.com on 19 Oct 2011 at 6:52

GoogleCodeExporter commented 9 years ago
Proper patch thanks to the guys from gtk-osx:
http://git.gnome.org/browse/gtk-osx/plain/patches/libproxy-Bug-052-POSIX_C_SOURC
E.patch

See also ticket at gtk-osx:
https://sourceforge.net/apps/trac/gtk-osx/ticket/58

Original comment by moser.ro...@gmail.com on 21 Oct 2011 at 5:16

GoogleCodeExporter commented 9 years ago
To answer the question in comment 3, the new (in 10.7 Lion) string.h includes 
symbols based on the definition of DARWIN_C_LEVEL, which is set from 
POSIX_C_SOURCE, where earlier versions simply checked for POSIX_C_SOURCE to be 
defined.

Values of POSIX_C_SOURCE that it uses in string.h are 199506L, 200112L, 
200809L. strdup() is defined at the middle level.

See also Bug 45, which was about a similar problem with POSIX_C_SOURCE.

Original comment by jra...@ceridwen.us on 29 Oct 2011 at 11:31

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r824.

Original comment by dominiqu...@gmail.com on 2 Nov 2011 at 10:56

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r826.

Original comment by dominiqu...@gmail.com on 2 Nov 2011 at 10:58

GoogleCodeExporter commented 9 years ago
Issue 180 has been merged into this issue.

Original comment by dominiqu...@gmail.com on 30 Jun 2012 at 5:27