Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac make install error: No such file or directory #142

Closed
Nomikitest opened this issue Oct 25, 2018 · 7 comments
Closed

Mac make install error: No such file or directory #142

Nomikitest opened this issue Oct 25, 2018 · 7 comments

Comments

@Nomikitest
Copy link

macOS high sierra

xx/test: git clone https://github.com/cs50/libcs50.git
then all things done.
xx/test: cd libcs50/
xx/test: sudo make install

cc -Wall -Wextra -Werror -pedantic -std=c99 -fPIC -shared -Wl,-install_name,libcs50-8.1.2.dylib -o libcs50-8.1.2.dylib src/cs50.c
ln -sf libcs50-8.dylib libcs50.dylib
mkdir -p build/include build/lib build/src
install -m 644 src/cs50.c build/src
install -m 644 src/cs50.h build/include
mv libcs50-8.1.2.dylib libcs50.dylib build/lib
cc -Wall -Wextra -Werror -pedantic -std=c99 -fPIC -shared -Wl,-install_name,libcs50-8.1.2.dylib -o libcs50-8.1.2.dylib src/cs50.c
ln -sf libcs50-8.dylib libcs50.dylib
mkdir -p build/include build/lib build/src
install -m 644 src/cs50.c build/src
install -m 644 src/cs50.h build/include
mv libcs50-8.1.2.dylib libcs50.dylib build/lib
mkdir -p /usr/local/src /usr/local/lib /usr/local/include /usr/local/share/man/man3
cp -r build/include build/lib build/src /usr/local
cp: build/lib/libcs50.dylib: No such file or directory

Something wrong with my operation?

@raksingh
Copy link

raksingh commented Nov 3, 2018

I had the same issue (on Mojave)
Seems like it's an an MacOS issue where symlinks in subdirectories are 'expanded' or resolved using the current directory instead of using the source directory.
Changed the 'cp' command in the Makefile to resolve it.

diff --git a/Makefile b/Makefile
index aa36a77..44550b3 100644
--- a/Makefile
+++ b/Makefile
@@ -43,8 +43,8 @@ $(LIBS): $(SRC) $(INCLUDE) Makefile
 .PHONY: install
 install: all
        mkdir -p $(addprefix $(DESTDIR)/, src lib include $(MANDIR))
-       cp -r $(filter-out deb, $(wildcard build/*)) $(DESTDIR)
-       cp -r $(MANS) $(DESTDIR)/$(MANDIR)
+       cp -R $(filter-out deb, $(wildcard build/*)) $(DESTDIR)
+       cp -R $(MANS) $(DESTDIR)/$(MANDIR)

 ifeq ($(OS),Linux)
        ldconfig

@loozhengyuan
Copy link

Had the same issue on Mojave as well. Thanks @raksingh, your solution helped!

@vcavallo
Copy link

Thanks @raksingh! Looks like this is still an issue on Mojave

@multitudes
Copy link

worked!!

@Searge
Copy link

Searge commented Mar 14, 2019

OS X El Capitan — worked.
THNX ツ

@suchov
Copy link

suchov commented Mar 25, 2019

Thx @raksingh

@critikaster
Copy link

Thanks @raksingh :)

@dmalan dmalan closed this as completed in 6636ce1 Jul 29, 2019
dmalan added a commit that referenced this issue Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants