Permalink
Browse files

core, bugfix: use posix_spawnp to check glibc_2.2, fix compile on i386.

  • Loading branch information...
xicilion committed Nov 8, 2017
1 parent c301b90 commit ce343b409eb939515ce2fa652e7b1be84618d697
Showing with 15 additions and 11 deletions.
  1. +10 −4 fibjs/CMakeLists.txt
  2. +3 −6 fibjs/src/process/SubProcess_posix.cpp
  3. +2 −1 fibjs/tools/config.h.in
View
@@ -21,11 +21,17 @@ set(EXECUTABLE_OUTPUT_PATH ${BIN_DIR})
include(CheckIncludeFiles)
include(CheckCSourceCompiles)
check_include_files(iconv.h HAVE_ICONV_H)
check_c_source_compiles("#include <string.h>
__asm__(\".symver memcpy,memcpy@GLIBC_2.2.5\");
void main(void){char buf[4]; memcpy(buf, \"1234\", 4);}" HAVE_GLIB_C_225_H)
set(CMAKE_C_FLAGS "${BUILD_OPTION}")
check_include_files(iconv.h HAVE_ICONV_H)
check_c_source_compiles("void posix_spawnp();
__asm__(\".symver posix_spawnp,posix_spawnp@GLIBC_2.2.5\");
void main(void){posix_spawnp();}" HAVE_GLIB_C_225_H)
check_c_source_compiles("void posix_spawnp();
__asm__(\".symver posix_spawnp,posix_spawnp@GLIBC_2.2\");
void main(void){posix_spawnp();}" HAVE_GLIB_C_22_H)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/gitinfo.h.in ${CMAKE_CURRENT_BINARY_DIR}/gitinfo.h)
@@ -7,6 +7,7 @@
#ifndef _WIN32
#include "config.h"
#include "object.h"
#include "ifs/process.h"
#include "SubProcess.h"
@@ -35,18 +36,14 @@ class PSTimer : public Timer {
intptr_t m_pid;
};
#ifdef Linux
#ifdef amd64
#ifdef HAVE_GLIB_C_225_H
__asm__(".symver posix_spawnp,posix_spawnp@GLIBC_2.2.5");
#endif
#ifdef i386
#ifdef HAVE_GLIB_C_22_H
__asm__(".symver posix_spawnp,posix_spawnp@GLIBC_2.2");
#endif
#endif
result_t SubProcess::create(exlib::string command, v8::Local<v8::Array> args, v8::Local<v8::Object> opts,
bool redirect, obj_ptr<SubProcess_base>& retVal)
{
View
@@ -1,4 +1,5 @@
#cmakedefine HAVE_ICONV_H 1
#cmakedefine HAVE_GLIB_C_225_H 1
#cmakedefine HAVE_GLIB_C_225_H 1
#cmakedefine HAVE_GLIB_C_22_H 1

0 comments on commit ce343b4

Please sign in to comment.