Open o-g-sus opened 6 years ago
I just commented out the “system(cmdbuf)” line to get around this error and build my project with Xcode 9.
I know it’s not really a fix but I don’t really know any situations where you would need this to work with libpd projects. I could be wrong!
-c
On Sep 28, 2017, at 6:53 AM, Oliver Greschke notifications@github.com wrote:
I have seen that people worked on that issue, but I sill get it with Xcode 9
s_file.c creates an error with system(cmdbuf);
static void sys_putpreference(const char key, const char value) { char cmdbuf[MAXPDSTRING]; snprintf(cmdbuf, MAXPDSTRING, "defaults write org.puredata.pd %s "%s" 2> /dev/null\n", key, value); system(cmdbuf); }
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/libpd/pd-for-ios/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYB726dfpzS7IAg-ab1x-17J1ch3ARwks5sm3qYgaJpZM4PnFEq.
My fix (using posix_spawn) for this problem:
#include <spawn.h>
extern char **environ;
void run_cmd(char *cmd)
{
pid_t pid;
char *argv[] = {"sh", "-c", cmd, NULL};
int status;
status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);
if (status == 0) {
if (waitpid(pid, &status, 0) == -1) {
perror("waitpid");
}
}
}
and call run_cmd(cmdbuf); instead of system(cmdbuf);
The fix is to simply not build s_file.c with the newer pd sources. This will be fixed in the next version of libpd which will come out soon, but you can try the current master if you need to be able to build/test for now.
Also, problems like these are better opened on the main libpd repository as this repo is mainly for hosting the iOS examples.
@mariusjcb Your fix is great, thank you. Has helped me a lot over the last few months.
I have seen that people worked on that issue, but I still get an error with Xcode 9
s_file.c creates an error with system(cmdbuf);
static void sys_putpreference(const char key, const char value) { char cmdbuf[MAXPDSTRING]; snprintf(cmdbuf, MAXPDSTRING, "defaults write org.puredata.pd %s \"%s\" 2> /dev/null\n", key, value); system(cmdbuf); }