5HT / fs

📁 FS: Windows, Linux, Mac Driver
https://fs.n2o.dev
Other
234 stars 69 forks source link

CoreServices.h File Not found when compiling fs #44

Closed cdesch closed 7 years ago

cdesch commented 7 years ago

In working with Phoenix 1.3, specifically the dep PhoenixLiveReload

On version 0.9.1 and 0.9.2 of :fs on elixir 1.3.2 and 1.4 (At this point, I think the error is version agnostic), I get this error that I cannot resolve.

Compiling c_src/mac/cli.c
In file included from c_src/mac/cli.c:2:
In file included from c_src/mac/cli.h:4:
c_src/mac/common.h:5:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^
1 error generated.
ERROR: compile failed while processing /Users/cj/elixir_projects/auth_armistice/deps/fs: rebar_abort
==> auth_armistice
** (Mix) Could not compile dependency :fs, "/Users/cj/.mix/rebar compile skip_deps=true deps_dir="/Users/cj/elixir_projects/auth_armistice/_build/dev/lib"" command failed. You ca
n recompile this dependency with "mix deps.compile fs", update it with "mix deps.update fs" or clean it with "mix deps.clean fs"

I feel like this is an issue with my system, MacOS 10.12.3 and not so much as a fs issue, although I've run out of place to turn to. The library is failing to compile -- I have all the libraries required in Phoenix Getting Started guide that were referenced phoenix framework issue 2102. I'm to the point where I'm going to reinstall elixir and erlang -- I think it might be Kiex but I'm having trouble narrowing down where the issue is.

Are other people running into this issue?

5HT commented 7 years ago
$ locate /CoreServices.h
$ export CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include"
5HT commented 7 years ago

Also it could be a problem with rebar. Try to build with mad:

$ git clone https://github.com/synrc/fs && cd fs $ wget https://github.com/synrc/mad/raw/master/mad && chmod 755 mad $ ./mad com

Just to be sure if everything ok with mad

cdesch commented 7 years ago

The first option did not work gist

Looks like mad has a problem as well:

cjsMBP15:fs cj$  ./mad com
==> "/Users/cj/elixir_projects/fs"
Compiling /src/sys/kqueue.erl
Compiling /src/sys/inotifywait_win32.erl
Compiling /src/sys/inotifywait.erl
Compiling /src/sys/fsevents.erl
Compiling /src/fs_sup.erl
Compiling /src/fs_server.erl
Compiling /src/fs_event_bridge.erl
Compiling /src/fs_app.erl
Compiling /src/fs.erl
Writing /ebin/fs.app
cc -c -Wno-deprecated-declarations -g -Wall -fPIC -MMD  -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/lib/erl_interface-3.9.2/include -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/erts-8.2.2/include  /Users/cj/elixir_projects/fs/c_src/mac/main.c -o /Users/cj/elixir_projects/fs/c_src/mac/main.o
cc -c -Wno-deprecated-declarations -g -Wall -fPIC -MMD  -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/lib/erl_interface-3.9.2/include -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/erts-8.2.2/include  /Users/cj/elixir_projects/fs/c_src/mac/compat.c -o /Users/cj/elixir_projects/fs/c_src/mac/compat.o
cc -c -Wno-deprecated-declarations -g -Wall -fPIC -MMD  -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/lib/erl_interface-3.9.2/include -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/erts-8.2.2/include  /Users/cj/elixir_projects/fs/c_src/mac/cli.c -o /Users/cj/elixir_projects/fs/c_src/mac/cli.o
Port Compilation Error:[{error,<<"In file included from /Users/cj/elixir_projects/fs/c_src/mac/main.c:1:\n/Users/cj/elixir_projects/fs/c_src/mac/common.h:5:10: fatal error: 'CoreServices/CoreServices.h' file not found\n#include <CoreServices/CoreServices.h>\n         ^\n1 error generated.\n">>},
                        {error,<<"In file included from /Users/cj/elixir_projects/fs/c_src/mac/compat.c:1:\n/Users/cj/elixir_projects/fs/c_src/mac/compat.h:16:10: fatal error: 'CoreServices/CoreServices.h' file not found\n#include <CoreServices/CoreServices.h>\n         ^\n1 error generated.\n">>},
                        {error,<<"In file included from /Users/cj/elixir_projects/fs/c_src/mac/cli.c:2:\nIn file included from /Users/cj/elixir_projects/fs/c_src/mac/cli.h:4:\n/Users/cj/elixir_projects/fs/c_src/mac/common.h:5:10: fatal error: 'CoreServices/CoreServices.h' file not found\n#include <CoreServices/CoreServices.h>\n         ^\n1 error generated.\n">>}]
ERROR: "/Users/cj/elixir_projects/fs"
cjsMBP15:fs cj$ 

Maybe I need to reinstall the library for CoreServices?

sumerman commented 7 years ago

@cdesch do you have xcode installed?

cdesch commented 7 years ago

yes, XCode Version 8.2.1 (8C1002) - I've built and deployed iOS apps to the App store - Even React-Native Apps. Maybe the sdk needs reinstallation.

It certainly wasn't Erlang or Elixir in the reinstall. Next layer I suppose

cdesch commented 7 years ago

I'm not exactly sure what changed, although it is working. I rebooted recently since last trying the to run the ./mad com. Today, running it works as well as compiling phoenix 1.3.0-rc and 1.3.0rc.1 with phoenix_live_reload and fs 0.9.1 on Elixir 1.4.2

Just to back step on some of the things I was fiddling with:

Here is the console successful output:


cjsMBP15:fs cj$ ./mad com
==> "/Users/cj/elixir_projects/fs"
cc -c -Wno-deprecated-declarations -g -Wall -fPIC -MMD  -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/lib/erl_interface-3.9.2/include -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/erts-8.2.2/include  /Users/cj/elixir_projects/fs/c_src/mac/main.c -o /Users/cj/elixir_projects/fs/c_src/mac/main.o
cc -c -Wno-deprecated-declarations -g -Wall -fPIC -MMD  -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/lib/erl_interface-3.9.2/include -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/erts-8.2.2/include  /Users/cj/elixir_projects/fs/c_src/mac/compat.c -o /Users/cj/elixir_projects/fs/c_src/mac/compat.o
cc -c -Wno-deprecated-declarations -g -Wall -fPIC -MMD  -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/lib/erl_interface-3.9.2/include -I/usr/local/Cellar/erlang/19.2.3/lib/erlang/erts-8.2.2/include  /Users/cj/elixir_projects/fs/c_src/mac/cli.c -o /Users/cj/elixir_projects/fs/c_src/mac/cli.o
cc /Users/cj/elixir_projects/fs/c_src/mac/main.o /Users/cj/elixir_projects/fs/c_src/mac/compat.o /Users/cj/elixir_projects/fs/c_src/mac/cli.o -framework CoreFoundation -framework CoreServices  -L/usr/local/Cellar/erlang/19.2.3/lib/erlang/lib/erl_interface-3.9.2/lib -lerl_interface -lei -o priv/mac_listener
OK
cjsMBP15:fs cj$ ls
LICENSE      README.md    c_src        ebin         include      mad          package.exs  priv         rebar.config src
cjsMBP15:auth_armistice cj$ ls
README.md _build    assets    config    deps      lib       mix.exs   mix.lock  priv      test
cjsMBP15:auth_armistice cj$ mix deps.compile
==> fs (compile)
Compiling c_src/mac/cli.c
Compiling c_src/mac/compat.c
Compiling c_src/mac/main.c
==> gettext
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 20 files (.ex)
Generated gettext app
===> Compiling ranch
==> poolboy (compile)
Compiled src/poolboy_sup.erl
Compiled src/poolboy_worker.erl
Compiled src/poolboy.erl
==> decimal
Compiling 1 file (.ex)
Generated decimal app
==> poison
Compiling 4 files (.ex)
Generated poison app
==> db_connection
Compiling 23 files (.ex)
Generated db_connection app
==> phoenix_pubsub
Compiling 12 files (.ex)
Generated phoenix_pubsub app
===> Compiling cowlib
src/cow_multipart.erl:392: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1

===> Compiling cowboy
==> mime
Compiling 1 file (.ex)
Generated mime app
==> plug
Compiling 44 files (.ex)
Generated plug app
==> phoenix_html
Compiling 8 files (.ex)
Generated phoenix_html app
==> phoenix
Compiling 71 files (.ex)
Generated phoenix app
==> phoenix_live_reload
Compiling 3 files (.ex)
Generated phoenix_live_reload app
==> postgrex
Compiling 62 files (.ex)
Generated postgrex app
==> ecto
Compiling 69 files (.ex)
Generated ecto app
==> phoenix_ecto
Compiling 4 files (.ex)
Generated phoenix_ecto app

I wish I could provide more insight on the resolution of this issue, but that's all I have for now. Please let me know if anyone wants me to run any diagnostics or profiles of my system. thanks for the assistance @sumerman @5HT

davidsilvasmith commented 7 years ago

I had the same issue.

I'm on macOS Sierra 10.12.3.

Weird - I restarted and that fixed it for me too.

I DID NOT try any of these.

Before restarting I did try

locate /CoreServices.h export CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include"

cdesch commented 7 years ago

I think something is cached. Before I had restart Elixir was throwing a lot of warnings -- after, hardly any.

cdesch commented 7 years ago

this occurred again and was related to kiex

I installed Kiex, installed a new version of elixir. ran mix deps.get and mix deps.compile and some other operations. Then switched back to the original version of elixir, ran mix deps.clean --all ran mix deps.get ran mix deps.compile..... bomb error.

Rebooting and repeating the mix deps.clean --all ran mix deps.get ran mix deps.compile fixes it.

glaksmono commented 7 years ago

Hi @cdesch @davidsilvasmith

It looks like I'm also facing a "similar" issue. I've tried to restarted my computer, and ran mix deps.clean --all, then mix deps.get, then mix deps.compile, but still resulted in the following error:

➜  hello_phoenix mix deps.compile
==> connection
Compiling 1 file (.ex)
Generated connection app
==> fs (compile)
Compiled src/sys/inotifywait_win32.erl
Compiled src/sys/inotifywait.erl
Compiled src/sys/fsevents.erl
Compiled src/fs_event_bridge.erl
Compiled src/fs_sup.erl
Compiled src/fs_app.erl
Compiled src/fs_server.erl
Compiled src/fs.erl
Compiling c_src/mac/cli.c
In file included from c_src/mac/cli.c:2:
In file included from c_src/mac/cli.h:4:
In file included from c_src/mac/common.h:5:
In file included from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:23:
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20:
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:208:
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/HFSVolumes.h:25:
/usr/include/hfs/hfs_format.h:794:2: error: unknown type name 'uuid_string_t'; did you mean 'io_string_t'?
        uuid_string_t   ext_jnl_uuid;
        ^
/usr/include/device/device_types.h:89:16: note: 'io_string_t' declared here
typedef char                    io_string_t[512];
                                ^
In file included from c_src/mac/cli.c:2:
In file included from c_src/mac/cli.h:4:
In file included from c_src/mac/common.h:5:
In file included from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:23:
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20:
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:208:
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/HFSVolumes.h:25:
/usr/include/hfs/hfs_format.h:796:20: error: use of undeclared identifier 'uuid_string_t'
        char            reserved[JIB_RESERVED_SIZE];
                                 ^
/usr/include/hfs/hfs_format.h:787:61: note: expanded from macro 'JIB_RESERVED_SIZE'
#define JIB_RESERVED_SIZE  ((32*sizeof(u_int32_t)) - sizeof(uuid_string_t) - 48)
                                                            ^
2 errors generated.
ERROR: compile failed while processing /Users/glaksmono/Desktop/hello_phoenix/deps/fs: rebar_abort
==> hello_phoenix
** (Mix) Could not compile dependency :fs, "/Users/glaksmono/.mix/rebar compile skip_deps=true deps_dir="/Users/glaksmono/Desktop/hello_phoenix/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile fs", update it with "mix deps.update fs" or clean it with "mix deps.clean fs"

Thoughts about this?

I was simply trying to follow the phoenis "Getting Started" tutorial: http://www.phoenixframework.org/docs/up-and-running