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

Does anyone successfully build VMAF in Cygwin ? ld: cannot find -lptools #62

Closed
tjtjtjtj-tw opened this issue Feb 21, 2017 · 11 comments
Closed

Comments

@tjtjtjtj-tw
Copy link

I tried to build it in Cygwin latest version.
All the targets except "wrapper" directory compiled successfully.

That is, vmaf-master/wrapper/Makefile doesn't seem to work in Cygwin.
I added "-D_GNU_SOURCE" to CXXFLAGS in Makefile to let several C++ source file compile successfully.
ld.exe complained "cannot find -lptools" and the linking was not successful.

Does anyone know how to make it right?

Thank you.

@li-zhi
Copy link
Collaborator

li-zhi commented Feb 22, 2017

@tjtjtjtj-tw If you look carefully, it might be that the building of the ptools library failed. Would you like to cd to ptools dir and see if you can make it successfully there?

@tjtjtjtj-tw
Copy link
Author

Dear li-zhi,

I see there is a libptools.so successfully built.
ptool directory is built using Makefile.VMAF.

So... am I wrong with something?
I don't know if Cygwin + Makefile.VMAF in ptool directory is supposed to be used or not.

Thank you.

@tjtjtjtj-tw
Copy link
Author

The error message from make is:

make[1]: Entering directory '/home/tjtjtjtj/vmaf-master/wrapper'
g++ -o vmafossexec /home/tjtjtjtj/vmaf-master/wrapper/obj/alloc.o /home/tjtjtjtj/vmaf-master/wrapper/obj/file_io.o /home/tjtjtjtj/vmaf-master/wrapper/obj/cpu.o /home/tjtjtjtj/vmaf-master/wrapper/obj/convolution.o /home/tjtjtjtj/vmaf-master/wrapper/obj/convolution_avx.o /home/tjtjtjtj/vmaf-master/wrapper/obj/adm.o /home/tjtjtjtj/vmaf-master/wrapper/obj/adm_tools.o /home/tjtjtjtj/vmaf-master/wrapper/obj/ansnr.o /home/tjtjtjtj/vmaf-master/wrapper/obj/ansnr_tools.o /home/tjtjtjtj/vmaf-master/wrapper/obj/vif.o /home/tjtjtjtj/vmaf-master/wrapper/obj/vif_tools.o /home/tjtjtjtj/vmaf-master/wrapper/obj/motion.o /home/tjtjtjtj/vmaf-master/wrapper/obj/psnr.o /home/tjtjtjtj/vmaf-master/wrapper/obj/math_utils.o /home/tjtjtjtj/vmaf-master/wrapper/obj/convolve.o /home/tjtjtjtj/vmaf-master/wrapper/obj/decimate.o /home/tjtjtjtj/vmaf-master/wrapper/obj/ssim_tools.o /home/tjtjtjtj/vmaf-master/wrapper/obj/ssim.o /home/tjtjtjtj/vmaf-master/wrapper/obj/ms_ssim.o /home/tjtjtjtj/vmaf-master/wrapper/obj/svm.o /home/tjtjtjtj/vmaf-master/wrapper/obj/combo.o /home/tjtjtjtj/vmaf-master/wrapper/obj/vmaf.o /home/tjtjtjtj/vmaf-master/wrapper/obj/darray.o /home/tjtjtjtj/vmaf-master/wrapper/obj/main.o /home/tjtjtjtj/vmaf-master/wrapper/obj/pugixml.o -L/home/tjtjtjtj/vmaf-master/wrapper/../ptools -lm -lpthread -lptools -Wl,-rpath=/home/tjtjtjtj/vmaf-master/wrapper/../ptools

/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lptools

collect2: Error:ld return 1
make[1]: *** [Makefile:129: vmafossexec] Error 1
make[1]: Leaving directory '/home/tjtjtjtj/vmaf-master/wrapper'

@cosmin
Copy link
Contributor

cosmin commented Feb 22, 2017

If I remember correctly someone had a similar issue with lptools on Linux that ended up being caused by Windows style line endings (based on how they cloned the repo). Since you are having a similar issue on Cygwin I wonder if this is a similar issue. Can you try to run dos2unix on the entire checkout? (Or change your git settings to preserve the original line endings). I wonder if that would make a difference.

@tjtjtjtj-tw
Copy link
Author

@cosmin
I tried to dos2unix everything hierarchically under vmaf-master/ptool as well as vmaf-master/wrapper, and this doesn't make any difference.
The problem remains.
However, thank you anyway.

@tjtjtjtj-tw tjtjtjtj-tw changed the title Does anyone successfully build VMAF in Cygwin ? Does anyone successfully build VMAF in Cygwin ? ld: cannot find -lptools Feb 23, 2017
@li-zhi
Copy link
Collaborator

li-zhi commented Feb 24, 2017

@tjtjtjtj-tw It's probably related to wrapper/Makefile. I have this switch:

vmafossexec: $(OBJS)
ifeq ($(shell uname),Darwin)
$(CXX) -o $@ $(LDFLAGS) $^ -L$(PTOOLSDIR) $(LIBS) -Wl
else
$(CXX) -o $@ $(LDFLAGS) $^ -L$(PTOOLSDIR) $(LIBS) -Wl,-rpath=$(PTOOLSDIR)
endif

It detects the OS version (Darwin is for mac os) and run differently to build vmafossexec. I don't know what's the correct way for cygwin, you can probably try it out.

(Also in ptools, there is another switch:

libptools : $(COM_OBJS)
ifeq ($(shell uname),Darwin)
$(CC) $(CCFLAGS) $(COM_OBJS) -dynamiclib -install_name $(shell pwd)/libptools.dylib -o libptools.dylib
else
$(CC) $(CCFLAGS) $(COM_OBJS) -shared -o libptools.so
endif

here libptools.dylib is for mac os and libptools.so is for linux/debian only(?)

)

@tjtjtjtj-tw
Copy link
Author

The settings for Mac doesn't work correctly in Cygwin.
The problem remains.

@tjtjtjtj-tw
Copy link
Author

@li-zhi @cosmin
Dear all,

I do a modification for Makefile in ptool directory for Cygwin.
The libptools is supposed to be a shared library (libptools.so in Linux and libptools.dylib in Mac OS) originally .
I added one line to create a static library "libptools.a".
Then the vmafossexec.exe is successfully created. (However it is a 6737898-byte executable. XD )

Change from:
=======Original Makefile(in ptools directory) begin=======
libptools : $(COM_OBJS)
ifeq ($(shell uname),Darwin)
$(CC) $(CCFLAGS) $(COM_OBJS) -dynamiclib -install_name $(shell pwd)/libptools.dylib -o libptools.dylib
else
$(CC) $(CCFLAGS) $(COM_OBJS) -shared -o libptools.so
endif

=======Original Makefile(in ptools directory) end=======

Change to:
=======Modified Makefile(in ptools directory) begin=======
libptools : $(COM_OBJS)
ifeq ($(shell uname),Darwin)
$(CC) $(CCFLAGS) $(COM_OBJS) -dynamiclib -install_name $(shell pwd)/libptools.dylib -o libptools.dylib
else
$(CC) $(CCFLAGS) $(COM_OBJS) -shared -o libptools.so

ar rcs libptools.a $(COM_OBJS)

endif
=======Modified Makefile(in ptools directory) end=======

@tjtjtjtj-tw
Copy link
Author

I am not an expert in makefile writing so it is kind if anyone familiar with it can commit the modification for Cygwin properly.

I summarize the change need to be applied to let vmaf be created successfully in Cygwin :

  1. Add "-D_GNU_SOURCE" to CXXFLAGS in vmaf-master/wrapper/Makefile to let several C++ source file compile successfully.
  2. Add "ar rcs libptools.a $(COM_OBJS)" in vmaf-master/ptools/Makefile to create a static library "libptools.a".

@li-zhi
Copy link
Collaborator

li-zhi commented Mar 2, 2017

@tjtjtjtj-tw Thanks for the suggestion. Please keep this thread open so that I (or someone else) could pick it up later.

@ghost
Copy link

ghost commented Jul 14, 2017

i have same problem
what exactly means
Add "-D_GNU_SOURCE" to CXXFLAGS in vmaf-master/wrapper/Makefile to let several C++ source file compile successfully.
where i should add "-D_GNU_SOURCE" ?

nilfm pushed a commit that referenced this issue Dec 8, 2022
Merge in MCE/vmaf-private-lts from feature/add-2160-model-in-routine-christosb to master

* commit '66358a760657ef58a5e0d1fb8166b9acce2623f0':
  Add 2160p model in routine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants