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

dutf8.c:(.text+0x8): undefined reference to `_imp__nc_utf8proc_iterate' #404

Closed
4 tasks done
Reino17 opened this issue May 12, 2017 · 6 comments
Closed
4 tasks done

Comments

@Reino17
Copy link

Reino17 commented May 12, 2017

  • What platform are you using? (please provide specific distribution/version in summary)
    • Windows
  • 32 and/or 64 bit?
    • 32-bit
  • What build system are you using?
    • autotools (configure) (gcc 4.9.4)
  • Can you provide a sample netCDF file or C code to recreate the issue?
    • No

I'm using Roger's "ffmpeg-windows-build-helpers"-script to cross-compile FFMpeg with netCDF, but with an updated "build_netcdf"-function:

build_netcdf() {
  download_and_unpack_file https://github.com/Unidata/netcdf-c/archive/v4.4.1.1.tar.gz netcdf-c-4.4.1.1
  cd netcdf-c-4.4.1.1
    if [[ ! -f Makefile.in.bak ]]; then # Library only.
      sed -i.bak "/\tshare/s/share.*3 //" Makefile.in
    fi
    generic_configure "--disable-netcdf-4 --disable-dap --disable-examples --disable-utilities --disable-testsets"
    do_make_and_make_install
  cd ..
}

As you can see; v4.4.1.1 instead of v4.4.1. NetCDF is built without errors, as well as FFMpeg in the end.

When I however start using your Git-repository, then netCDF still builds without errors, but FFMpeg terminates with a fatal error:

build_netcdf() {
  do_git_checkout https://github.com/Unidata/netcdf-c.git
  cd netcdf-c_git
    apply_patch file://$patch_dir/netcdf-c_git_lib-only.diff
    generic_configure "--disable-netcdf-4 --disable-dap --disable-examples --disable-utilities --disable-testsets"
    do_make_and_make_install
  cd ..
}
...
LD      ffmpeg_g.exe
/cygdrive/d/ffmpeg-windows-build-helpers-master/native_build/windows/ffmpeg_local_builds/sand
box/cross_compilers/mingw-w64-i686/i686-w64-mingw32/lib/libnetcdf.a(libdispatch_la-dutf8.o):d
utf8.c:(.text+0x8): undefined reference to `_imp__nc_utf8proc_iterate'
collect2: error: ld returned 1 exit status
make: *** [Makefile:148: ffmpeg_g.exe] Error 1

I've done quite some searching for _imp__nc_utf8proc_iterate and if it's perhaps some library I'm missing, but Google returns practically nothing.
I have practically no experience with coding in C/C++, but in libdispatch/dutf8.c I can see nc_utf8proc_iterate being used, which (if I'm correct) is defined in libdispatch/utf8proc.h, so shouldn't it work?
Is this is real bug, or am I missing something?


'netcdf-c_git_lib-only.diff':

diff -ur libsrc/Makefile.am.bak libsrc/Makefile.am
--- libsrc/Makefile.am.bak	2017-04-28 17:28:44.062500000 +0200
+++ libsrc/Makefile.am	2017-04-28 17:55:23.468750000 +0200
@@ -42,28 +42,9 @@
 # These files are cleaned on developer workstations (and then rebuilt
 # with m4), but they are included in the distribution so that the user
 # does not have to have m4.
-MAINTAINERCLEANFILES = $(man_MANS) attrx.c ncx.c putgetx.c
-EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
+MAINTAINERCLEANFILES = attrx.c ncx.c putgetx.c
+EXTRA_DIST = attr.m4 ncx.m4 putget.m4 CMakeLists.txt XGetopt.c
 
 # This tells make how to turn .m4 files into .c files.
 .m4.c:
 	m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< > $@
-
-# The C API man page.
-man_MANS = netcdf.3
-
-# Decide what goes in the man page, based on user configure options.
-ARGS_MANPAGE = -DAPI=C
-if USE_NETCDF4
-ARGS_MANPAGE += -DNETCDF4=TRUE
-endif
-if BUILD_DAP
-ARGS_MANPAGE += -DDAP=TRUE
-endif
-if BUILD_PARALLEL
-ARGS_MANPAGE += -DPARALLEL_IO=TRUE
-endif
-
-# This rule generates the C manpage.
-netcdf.3: $(top_srcdir)/docs/netcdf.m4
-	m4 $(M4FLAGS) $(ARGS_MANPAGE) $? >$@  || rm $@
@WardF
Copy link
Member

WardF commented May 16, 2017

Interesting, I did not realize that ffmpeg had netcdf support. nc_utf8proc_iterate is a netCDF function, certainly. There isn't an obvious reason that I can see that this would be failing; let me take a look and see if I can recreate it.

@Reino17
Copy link
Author

Reino17 commented Jun 18, 2017

Last week FFmpeg has stopped using netCDF-C in favour of libmysofa. This issue has become superfluous as there's no need to solve it anymore, so I'm closing it now.
You're of course free to continue investigating this issue, but then you can only use versions of FFmpeg before FFmpeg/FFmpeg@2336c76.

@Reino17 Reino17 closed this as completed Jun 18, 2017
@DennisHeimbigner
Copy link
Collaborator

I did some searching and found this:

https://stackoverflow.com/questions/5159353/how-can-i-get-rid-of-the-imp-prefix-in-the-linker-in-vc
It says:
The imp prefix appears whenever you are linking to a DLL. It does not appear when linking to
statically linked libraries. Most likely the code is generated to be linked against a DLL import lib,
but you have linked it with a static lib instead.
The prefix is added when you mark the imported function with __declspec(dllimport) - make sure
your imports are not using this when not linking against a DLL.
Still leaves questions unanswered, but closer to a solution.

DennisHeimbigner added a commit that referenced this issue Jun 19, 2017
This is a follow-on in that the old utf8 code was still being
used in ncgen to convert utf8->utf16 when converting cdl to Java
(see genj.c).

The new code apparently has no utf16 support, but it does have
utf32 support. Converting utf32 -> utf16 can be approximated by
truncating the 32bits to 16 bits, unless the top 16 bits are
not zero. This latter condition is unlikely to be common because
it implies use of some rather obscure characters.

So solution is to convert to utf32 and truncate to 16 bits to
get utf16. An error is reported if the high-order truncated 16
bits are not zero. If we get complaints, then I will figure out
how to convert full utf32 to a utf16 pair.

Other changes:
1. removed the old code from ncgen.
2. changed UTF8PROC_DLLEXPORT (in utf8proc) to EXTERNL
   and added appropriate includes. This should fix
   issue #404,
   but since we cannot duplicate the failure, I am not quite
   sure.
@DennisHeimbigner
Copy link
Collaborator

This may have been fixed by pull request #430.
But since we cannot duplicate the failure, I am not quite sure. Closing for now.

@Reino17
Copy link
Author

Reino17 commented Jun 20, 2017

I've just tried to compile FFmpeg (https://github.com/FFmpeg/FFmpeg/tree/a32a6b4201dca46c54247194bd5249dfb7c64874, a version that still uses netCDF-C) with the latest netCDF-C version from git. Result; the same error-message:

LD      ffmpeg_g.exe
/cygdrive/m/ffmpeg-windows-build-helpers-master/native_build/windows/ffmpeg_local_builds/sand
box/cross_compilers/mingw-w64-i686/i686-w64-mingw32/lib/libnetcdf.a(libdispatch_la-dutf8.o):d
utf8.c:(.text+0x15): undefined reference to `_imp__nc_utf8proc_iterate'
collect2: error: ld returned 1 exit status
make: *** [Makefile:143: ffmpeg_g.exe] Error 1

@DennisHeimbigner
Copy link
Collaborator

Then I have no fix and no idea why it fails. It works for my Visual Studio. Sorry.

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

3 participants